fast-json-stringify
Advanced tools
Comparing version 1.9.0 to 1.9.1
12
index.js
@@ -521,3 +521,3 @@ 'use strict' | ||
if (merged.if && merged.then) { | ||
innerR = addIfThenElse(merged, name, externalSchema, fullSchema) | ||
innerR = addIfThenElse(merged, name + 'Then', externalSchema, fullSchema) | ||
code += innerR.code | ||
@@ -527,3 +527,3 @@ laterCode = innerR.laterCode | ||
r = buildInnerObject(merged, name, externalSchema, fullSchema) | ||
r = buildInnerObject(merged, name + 'Then', externalSchema, fullSchema) | ||
code += r.code | ||
@@ -543,3 +543,3 @@ laterCode += r.laterCode | ||
if (merged.if && merged.then) { | ||
innerR = addIfThenElse(merged, name, externalSchema, fullSchema) | ||
innerR = addIfThenElse(merged, name + 'Else', externalSchema, fullSchema) | ||
code += innerR.code | ||
@@ -549,3 +549,3 @@ laterCode += innerR.laterCode | ||
r = buildInnerObject(merged, name, externalSchema, fullSchema) | ||
r = buildInnerObject(merged, name + 'Else', externalSchema, fullSchema) | ||
code += r.code | ||
@@ -562,4 +562,4 @@ laterCode += r.laterCode | ||
function toJSON (variableName) { | ||
return `typeof ${variableName}.toJSON === 'function' | ||
? ${variableName}.toJSON() | ||
return `typeof ${variableName}.toJSON === 'function' | ||
? ${variableName}.toJSON() | ||
: ${variableName} | ||
@@ -566,0 +566,0 @@ ` |
{ | ||
"name": "fast-json-stringify", | ||
"version": "1.9.0", | ||
"version": "1.9.1", | ||
"description": "Stringify your JSON at max speed", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,3 +36,13 @@ 'use strict' | ||
'hi': { 'type': 'string' }, | ||
'hello': { 'type': 'number' } | ||
'hello': { 'type': 'number' }, | ||
'list': { | ||
'type': 'array', | ||
'items': { | ||
'type': 'object', | ||
'properties': { | ||
'name': { 'type': 'string' }, | ||
'value': { 'type': 'string' } | ||
} | ||
} | ||
} | ||
} | ||
@@ -138,2 +148,7 @@ } | ||
const nestedDeepElseSchema = { | ||
'type': 'object', | ||
'additionalProperties': schema | ||
} | ||
const fooBarInput = { | ||
@@ -170,2 +185,5 @@ kind: 'foobar', | ||
} | ||
const deepFoobarInput = { | ||
foobar: fooBarInput | ||
} | ||
const foobarOutput = JSON.stringify({ | ||
@@ -190,2 +208,5 @@ kind: 'foobar', | ||
}) | ||
const deepFoobarOutput = JSON.stringify({ | ||
foobar: JSON.parse(foobarOutput) | ||
}) | ||
@@ -241,2 +262,8 @@ t.test('if-then-else', t => { | ||
expected: alphabetOutput | ||
}, | ||
{ | ||
name: 'deep then - else', | ||
schema: nestedDeepElseSchema, | ||
input: deepFoobarInput, | ||
expected: deepFoobarOutput | ||
} | ||
@@ -243,0 +270,0 @@ ] |
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
98207
3737