fast-json-stringify
Advanced tools
+4
-4
@@ -14,3 +14,3 @@ 'use strict' | ||
| code += ` | ||
| const properties = ${JSON.stringify(schema.properties)} | ||
| const properties = ${JSON.stringify(schema.properties)} || {} | ||
| ` | ||
@@ -108,4 +108,4 @@ code += ` | ||
| if (point === 34 || point === 92) { | ||
| result += str.slice(last, i) + '\\' + str[i] | ||
| last = i + 1 | ||
| result += str.slice(last, i) + '\\' | ||
| last = i | ||
| } | ||
@@ -269,3 +269,3 @@ } | ||
| Object.keys(schema.properties).forEach((key, i, a) => { | ||
| Object.keys(schema.properties || {}).forEach((key, i, a) => { | ||
| // Using obj.key !== undefined instead of obj.hasOwnProperty(prop) for perf reasons, | ||
@@ -272,0 +272,0 @@ // see https://github.com/mcollina/fast-json-stringify/pull/3 for discussion. |
+2
-2
| { | ||
| "name": "fast-json-stringify", | ||
| "version": "0.10.4", | ||
| "version": "0.10.5", | ||
| "description": "Stringify your JSON at max speed", | ||
@@ -30,3 +30,3 @@ "main": "index.js", | ||
| "pre-commit": "^1.1.3", | ||
| "standard": "^9.0.1", | ||
| "standard": "^10.0.0", | ||
| "tap": "^10.3.0" | ||
@@ -33,0 +33,0 @@ }, |
@@ -183,1 +183,58 @@ 'use strict' | ||
| }) | ||
| test('nested additionalProperties', (t) => { | ||
| t.plan(1) | ||
| const stringify = build({ | ||
| title: 'additionalProperties', | ||
| type: 'array', | ||
| items: { | ||
| type: 'object', | ||
| properties: { | ||
| ap: { | ||
| type: 'object', | ||
| additionalProperties: { type: 'string' } | ||
| } | ||
| } | ||
| } | ||
| }) | ||
| let obj = [{ ap: { value: 'string' } }] | ||
| t.equal('[{"ap":{"value":"string"}}]', stringify(obj)) | ||
| }) | ||
| test('very nested additionalProperties', (t) => { | ||
| t.plan(1) | ||
| const stringify = build({ | ||
| title: 'additionalProperties', | ||
| type: 'array', | ||
| items: { | ||
| type: 'object', | ||
| properties: { | ||
| ap: { | ||
| type: 'object', | ||
| properties: { | ||
| nested: { | ||
| type: 'object', | ||
| properties: { | ||
| moarNested: { | ||
| type: 'object', | ||
| properties: { | ||
| finally: { | ||
| type: 'object', | ||
| additionalProperties: { | ||
| type: 'string' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }) | ||
| let obj = [{ ap: { nested: { moarNested: { finally: { value: 'str' } } } } }] | ||
| t.equal('[{"ap":{"nested":{"moarNested":{"finally":{"value":"str"}}}}}]', stringify(obj)) | ||
| }) |
Network access
Supply chain riskThis module accesses the network.
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
Network access
Supply chain riskThis module accesses the network.
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
44781
3.09%1543
3.56%