+3
-2
@@ -5,6 +5,7 @@ { | ||
| "description": "JavaScript Super Notation (JSON + circular refs + dates + (optional)functions)", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "keywords": [], | ||
| "dependencies": { | ||
| "component/object": "*" | ||
| "component/object": "*", | ||
| "ForbesLindesay/json": "*" | ||
| }, | ||
@@ -11,0 +12,0 @@ "development": {}, |
+25
-6
@@ -19,2 +19,21 @@ function type(val){ | ||
| var json = typeof JSON === 'object' ? JSON : require('json'); | ||
| function map(array, fn) { | ||
| if (array.map) return array.map(fn); | ||
| var res = []; | ||
| for (var i = 0; i < array.length; i++) { | ||
| res.push(fn(array[i], i, array)); | ||
| } | ||
| return res; | ||
| } | ||
| function filter(array, fn) { | ||
| if (array.filter) return array.filter(fn); | ||
| var res = []; | ||
| for (var i = 0; i < array.length; i++) { | ||
| if (fn(array[i], i, array)) res.push(array[i]); | ||
| } | ||
| return res; | ||
| } | ||
| exports.stringify = stringify; | ||
@@ -29,3 +48,3 @@ exports.parse = parse; | ||
| circular[0].encoded = encode(obj, circular, true); | ||
| return JSON.stringify(circular.map(function (o) { | ||
| return json.stringify(map(circular, function (o) { | ||
| return o.encoded; | ||
@@ -107,3 +126,3 @@ })); | ||
| function parse(str, constructors) { | ||
| var source = JSON.parse(str).map(function (o, i) { | ||
| var source = map(json.parse(str), function (o, i) { | ||
| if (type(o) === 'array') { | ||
@@ -130,6 +149,6 @@ return { | ||
| var parsed = /^function[^\(]*\(([^\)]*)\) ?\{((?:\n|\r|.)*)\}$/.exec(o); | ||
| if (!parsed) console.log(JSON.stringify(o)); | ||
| var args = parsed[1].split(',') | ||
| .map(function (a) { return a.trim(); }) | ||
| .filter(function (a) { return a; }); | ||
| if (!parsed) console.log(json.stringify(o)); | ||
| var args = filter(map(parsed[1].split(','), | ||
| function (a) { return a.trim(); }), | ||
| function (a) { return a; }); | ||
| args.push(parsed[2]); | ||
@@ -136,0 +155,0 @@ return Function.apply(null, args); |
+1
-1
| { | ||
| "name": "jssn", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "JavaScript Super Notation (JSON + circular refs + dates + (optional)functions)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
150958
0.34%5622
0.32%1
-50%