Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cson-parser

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cson-parser - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

6

CHANGELOG.md

@@ -0,1 +1,7 @@

### 2.0.1
* Apply latest nlm generator - **[@markowsiak](https://github.com/markowsiak)** [#69](https://github.com/groupon/cson-parser/pull/69)
- [`42a70eb`](https://github.com/groupon/cson-parser/commit/42a70eb38e5e3475a89ad4b67ebad34b1c3a1dc6) **chore:** Apply latest nlm generator
### 2.0.0

@@ -2,0 +8,0 @@

4

lib/cson-parser.js

@@ -32,3 +32,5 @@ /*

*/
'use strict';
var stringify = require('./stringify');

@@ -39,3 +41,3 @@ var parse = require('./parse');

stringify: stringify,
parse: parse
parse: parse,
};

@@ -32,3 +32,5 @@ /*

*/
'use strict';
var runInThisContext = require('vm').runInThisContext;

@@ -93,3 +95,5 @@ var nodes = require('coffee-script').nodes;

if (!expressions || expressions.length !== 1) {
throw new SyntaxError(syntaxErrorMessage(node, 'One top level value expected'));
throw new SyntaxError(
syntaxErrorMessage(node, 'One top level value expected')
);
}

@@ -182,4 +186,5 @@ return transformNode(expressions[0]);

default:
throw new SyntaxError(syntaxErrorMessage(node,
'Unknown binary operator ' + node.operator));
throw new SyntaxError(
syntaxErrorMessage(node, 'Unknown binary operator ' + node.operator)
);
}

@@ -193,4 +198,5 @@ } else {

default:
throw new SyntaxError(syntaxErrorMessage(node,
'Unknown unary operator ' + node.operator));
throw new SyntaxError(
syntaxErrorMessage(node, 'Unknown unary operator ' + node.operator)
);
}

@@ -203,7 +209,8 @@ }

if (!expressions || expressions.length !== 1) {
throw new SyntaxError(syntaxErrorMessage(node,
'Parenthesis may only contain one expression'));
throw new SyntaxError(
syntaxErrorMessage(node, 'Parenthesis may only contain one expression')
);
}
return transformNode(expressions[0]);
}
},
};

@@ -210,0 +217,0 @@

@@ -32,3 +32,5 @@ /*

*/
'use strict';
var jsIdentifierRE = /^[a-z_$][a-z0-9_$]*$/i;

@@ -43,3 +45,3 @@ var tripleQuotesRE = /'''/g;

function newlineWrap(str) {
return str && ('\n' + str + '\n');
return str && '\n' + str + '\n';
}

@@ -71,12 +73,17 @@

}
return str.split('\n').map(indentLine.bind(null, indent)).join('\n');
return str
.split('\n')
.map(indentLine.bind(null, indent))
.join('\n');
}
function singleQuoteStringify(str) {
return "'"
+ JSON.stringify(str)
.slice(1, -1)
.replace(/\\"/g, '"')
.replace(/'/g, "\\'")
+ "'";
return (
"'" +
JSON.stringify(str)
.slice(1, -1)
.replace(/\\"/g, '"')
.replace(/'/g, "\\'") +
"'"
);
}

@@ -89,5 +96,5 @@

function onelineStringify(str) {
return (
quoteType(str) === 'single' ? singleQuoteStringify : JSON.stringify
)(str);
return (quoteType(str) === 'single' ? singleQuoteStringify : JSON.stringify)(
str
);
}

@@ -102,7 +109,9 @@

var serializedValue = visitNode(value, {
bracesRequired: !indent
bracesRequired: !indent,
});
if (indent) {
serializedValue = isObject(value) && Object.keys(value).length > 0 ?
'\n' + (indentLines(indent, serializedValue)) : ' ' + serializedValue;
serializedValue =
isObject(value) && Object.keys(value).length > 0
? '\n' + indentLines(indent, serializedValue)
: ' ' + serializedValue;
}

@@ -116,7 +125,8 @@ return key + ':' + serializedValue;

return visitNode(value, {
bracesRequired: true
bracesRequired: true,
});
});
var serializedItems = indent ?
newlineWrap(indentLines(indent, items.join('\n'))) : items.join(',');
var serializedItems = indent
? newlineWrap(indentLines(indent, items.join('\n')))
: items.join(',');
return '[' + serializedItems + ']';

@@ -134,3 +144,3 @@ }

if (bracesRequired) {
return '{' + (newlineWrap(indentLines(indent, keyPairLines))) + '}';
return '{' + newlineWrap(indentLines(indent, keyPairLines)) + '}';
}

@@ -153,7 +163,8 @@ return keyPairLines;

string = str.replace(/\\/g, '\\\\').replace(tripleQuotesRE, "\\'''");
return "'''" + (newlineWrap(indentLines(indent, string))) + "'''";
return "'''" + newlineWrap(indentLines(indent, string)) + "'''";
}
function stringify(data, visitor, indent) {
if (typeof data === 'function' || typeof data === 'undefined') return undefined;
if (typeof data === 'function' || typeof data === 'undefined')
return undefined;
indent = parseIndent(indent);

@@ -160,0 +171,0 @@

{
"name": "cson-parser",
"version": "2.0.0",
"version": "2.0.1",
"description": "Safe parsing of CSON files",

@@ -10,3 +10,3 @@ "license": "BSD-3-Clause",

"type": "git",
"url": "git+ssh://git@github.com/groupon/cson-parser"
"url": "https://github.com/groupon/cson-parser"
},

@@ -33,8 +33,11 @@ "bugs": {

"assertive": "^2.1.0",
"eslint": "^2.0.0",
"eslint-config-groupon-es5": "^3.0.0",
"eslint-plugin-import": "^1.6.1",
"eslint-plugin-node": "^2.0.0",
"eslint": "^4.7.1",
"eslint-config-groupon": "^5.0.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-prettier": "^2.4.0",
"mocha": "^3.1.2",
"nlm": "^3.0.0"
"nlm": "^3.0.0",
"nodemon": "^1.0.0",
"prettier": "^1.9.2"
},

@@ -41,0 +44,0 @@ "author": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc