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

cson

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cson - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

37

out/lib/cson.js

@@ -18,5 +18,10 @@ // Generated by CoffeeScript 1.3.3

CSON = {
parseFile: function(filePath, next) {
parseFile: function(filePath, opts, next) {
var result,
_this = this;
if ((opts != null) === true && (next != null) === false) {
next = opts;
opts = null;
}
opts || (opts = {});
filePath = pathUtil.resolve(filePath);

@@ -27,2 +32,3 @@ if (/\.(js|coffee)$/.test(filePath)) {

result = require(filePath);
delete require.cache[filePath];
next(null, result);

@@ -39,3 +45,3 @@ } catch (err) {

dataStr = data.toString();
return _this.parse(dataStr, next);
return _this.parse(dataStr, opts, next);
});

@@ -48,4 +54,5 @@ } else {

},
parseFileSync: function(filePath) {
parseFileSync: function(filePath, opts) {
var data, dataStr, result;
opts || (opts = {});
filePath = pathUtil.resolve(filePath);

@@ -56,2 +63,3 @@ if (/\.(js|coffee)$/.test(filePath)) {

result = require(filePath);
delete require.cache[filePath];
return result;

@@ -67,3 +75,3 @@ } catch (err) {

dataStr = data.toString();
result = this.parseSync(dataStr);
result = this.parseSync(dataStr, opts);
}

@@ -76,7 +84,12 @@ return result;

},
parse: function(src, next) {
parse: function(src, opts, next) {
var _this = this;
if ((opts != null) === true && (next != null) === false) {
next = opts;
opts = null;
}
opts || (opts = {});
wait(0, function() {
var result;
result = _this.parseSync(src);
result = _this.parseSync(src, opts);
if (result instanceof Error) {

@@ -90,4 +103,8 @@ return next(result);

},
parseSync: function(src) {
var result;
parseSync: function(src, opts) {
var result, _ref;
opts || (opts = {});
if ((_ref = opts.sandbox) == null) {
opts.sandbox = true;
}
try {

@@ -97,3 +114,3 @@ result = JSON.parse(src);

try {
result = coffee["eval"](src);
result = coffee["eval"](src, opts);
} catch (err) {

@@ -125,3 +142,3 @@ result = err;

if (typeof obj === 'object') {
if (!(obj instanceof Array)) {
if (!Array.isArray(obj)) {
result = '{\n' + result + '\n}';

@@ -128,0 +145,0 @@ }

{
"name": "cson",
"version": "1.1.2",
"version": "1.2.0",
"description": "CoffeeScript-Object-Notation Parser. Same as JSON but for CoffeeScript objects",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/cson",

Sorry, the diff of this file is not supported yet

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