fast-json-stringify
Advanced tools
Comparing version 0.10.4 to 0.10.5
@@ -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. |
{ | ||
"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)) | ||
}) |
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
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
44781
1543