Comparing version 2.0.0 to 2.0.1
module.exports = require('./lib'); |
@@ -0,0 +0,0 @@ var pathGetter = require('./path-getter'); |
var cycle = require('./cycle'); | ||
exports.stringify = function stringify(value, replacer, space) { | ||
exports.stringify = function stringify(value, replacer, space, forceDecycle) { | ||
try { | ||
return JSON.stringify(value, replacer, space); | ||
} catch (e) { | ||
var decycled = cycle.decycle(value); | ||
if (!forceDecycle) { | ||
if (arguments.length === 1) { | ||
return JSON.stringify(value); | ||
} else { | ||
return JSON.stringify.apply(JSON, arguments); | ||
} | ||
} | ||
} catch (e) {} | ||
var decycled = cycle.decycle(value); | ||
if (arguments.length === 1) { | ||
return JSON.stringify(decycled); | ||
} else { | ||
return JSON.stringify(decycled, replacer, space); | ||
} | ||
} | ||
@@ -14,3 +24,8 @@ | ||
var needsRetrocycle = text.indexOf('"$ref"') > -1; | ||
var parsed = JSON.parse(text, reviver) | ||
var parsed; | ||
if (arguments.length === 1) { | ||
parsed = JSON.parse(text); | ||
} else { | ||
parsed = JSON.parse(text, reviver); | ||
} | ||
if (needsRetrocycle) { | ||
@@ -17,0 +32,0 @@ parsed = cycle.retrocycle(parsed); |
@@ -0,0 +0,0 @@ module.exports = pathGetter; |
{ | ||
"name": "jsan", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "handle circular references when stringifying and parsing", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,0 +0,0 @@ jsan |
@@ -0,0 +0,0 @@ var assert = require('assert'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17981
13
440
2