fast-json-stringify
Advanced tools
Comparing version 1.7.1 to 1.7.2
18
index.js
@@ -54,3 +54,3 @@ 'use strict' | ||
var hasShemaSomeIf = hasIf(schema) | ||
var hasSchemaSomeIf = hasIf(schema) | ||
@@ -98,3 +98,3 @@ var main | ||
var dependenciesName = [] | ||
if (hasAnyOf(schema) || hasShemaSomeIf) { | ||
if (hasAnyOf(schema) || hasSchemaSomeIf) { | ||
dependencies.push(new Ajv()) | ||
@@ -508,3 +508,3 @@ dependenciesName.push('ajv') | ||
code += ` | ||
valid = ajv.validate(${require('util').inspect(i, {depth: null})}, obj) | ||
valid = ajv.validate(${require('util').inspect(i, { depth: null })}, obj) | ||
if (valid) { | ||
@@ -520,3 +520,3 @@ ` | ||
code += r.code | ||
laterCode = r.laterCode | ||
laterCode += r.laterCode | ||
@@ -536,3 +536,3 @@ code += ` | ||
code += innerR.code | ||
laterCode = innerR.laterCode | ||
laterCode += innerR.laterCode | ||
} | ||
@@ -542,3 +542,3 @@ | ||
code += r.code | ||
laterCode = r.laterCode | ||
laterCode += r.laterCode | ||
@@ -596,3 +596,3 @@ code += ` | ||
var result = {code: '', laterCode: ''} | ||
var result = { code: '', laterCode: '' } | ||
if (Array.isArray(schema.items)) { | ||
@@ -732,3 +732,3 @@ result = schema.items.reduce((res, item, i) => { | ||
code += ` | ||
${index === 0 ? 'if' : 'else if'}(ajv.validate(${require('util').inspect(s, {depth: null})}, obj${accessor})) | ||
${index === 0 ? 'if' : 'else if'}(ajv.validate(${require('util').inspect(s, { depth: null })}, obj${accessor})) | ||
${nestedResult.code} | ||
@@ -754,3 +754,3 @@ ` | ||
sortedTypes.forEach((type, index) => { | ||
var tempSchema = Object.assign({}, schema, {type}) | ||
var tempSchema = Object.assign({}, schema, { type }) | ||
var nestedResult = nested(laterCode, name, key, tempSchema, externalSchema, fullSchema, subKey) | ||
@@ -757,0 +757,0 @@ if (type === 'string') { |
{ | ||
"name": "fast-json-stringify", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "Stringify your JSON at max speed", | ||
@@ -31,7 +31,7 @@ "main": "index.js", | ||
"benchmark": "^2.1.4", | ||
"is-my-json-valid": "^2.17.2", | ||
"is-my-json-valid": "^2.19.0", | ||
"long": "^4.0.0", | ||
"pre-commit": "^1.2.2", | ||
"proxyquire": "^2.0.0", | ||
"standard": "^11.0.1", | ||
"proxyquire": "^2.1.0", | ||
"standard": "^12.0.1", | ||
"tap": "^12.0.0", | ||
@@ -41,5 +41,5 @@ "uglify-es": "^3.3.9" | ||
"dependencies": { | ||
"ajv": "^6.5.1", | ||
"ajv": "^6.5.3", | ||
"deepmerge": "^2.1.1" | ||
} | ||
} |
@@ -21,3 +21,3 @@ 'use strict' | ||
let obj = { str: 'test', foo: 42, ofoo: true, foof: 'string', objfoo: {a: true} } | ||
let obj = { str: 'test', foo: 42, ofoo: true, foof: 'string', objfoo: { a: true } } | ||
t.equal('{"foo":"42","ofoo":"true","foof":"string","objfoo":"[object Object]","str":"test"}', stringify(obj)) | ||
@@ -24,0 +24,0 @@ }) |
@@ -77,3 +77,3 @@ 'use strict' | ||
const value = stringify({ | ||
prop: {str: 'string'} | ||
prop: { str: 'string' } | ||
}) | ||
@@ -80,0 +80,0 @@ t.is(value, '{"prop":{"str":"string"}}') |
@@ -13,3 +13,3 @@ 'use strict' | ||
const stringify = build(schema) | ||
const stringifyUgly = build(schema, {uglify: true}) | ||
const stringifyUgly = build(schema, { uglify: true }) | ||
const output = stringify(toStringify) | ||
@@ -96,3 +96,3 @@ const outputUglify = stringifyUgly(toStringify) | ||
}, { | ||
ids: [null, 'test', 1, 1.1, true, {a: 'test'}, ['test']] | ||
ids: [null, 'test', 1, 1.1, true, { a: 'test' }, ['test']] | ||
}) | ||
@@ -116,3 +116,3 @@ | ||
} | ||
}, {ids: [1, 2]}) | ||
}, { ids: [1, 2] }) | ||
@@ -145,3 +145,3 @@ buildTest({ | ||
} | ||
}, {args: [{a: 'test'}, {b: 1}]}) | ||
}, { args: [{ a: 'test' }, { b: 1 }] }) | ||
@@ -169,3 +169,3 @@ test('invalid items throw', (t) => { | ||
const stringify = build(schema) | ||
t.throws(() => stringify({args: ['invalid']})) | ||
t.throws(() => stringify({ args: ['invalid'] })) | ||
}) |
@@ -13,3 +13,3 @@ 'use strict' | ||
const stringify = build(schema) | ||
const stringifyUgly = build(schema, {uglify: true}) | ||
const stringifyUgly = build(schema, { uglify: true }) | ||
const output = stringify(toStringify) | ||
@@ -16,0 +16,0 @@ const outputUglify = stringifyUgly(toStringify) |
@@ -12,3 +12,3 @@ 'use strict' | ||
const stringifyUgly = build(schema, {uglify: true}) | ||
const stringifyUgly = build(schema, { uglify: true }) | ||
const output = stringify(toStringify) | ||
@@ -15,0 +15,0 @@ const outputUglify = stringifyUgly(toStringify) |
@@ -19,3 +19,13 @@ 'use strict' | ||
'foo': { 'type': 'string' }, | ||
'bar': { 'type': 'number' } | ||
'bar': { 'type': 'number' }, | ||
'list': { | ||
'type': 'array', | ||
'items': { | ||
'type': 'object', | ||
'properties': { | ||
'name': { 'type': 'string' }, | ||
'value': { 'type': 'string' } | ||
} | ||
} | ||
} | ||
} | ||
@@ -50,3 +60,13 @@ }, | ||
'foo': { 'type': 'string' }, | ||
'bar': { 'type': 'number' } | ||
'bar': { 'type': 'number' }, | ||
'list': { | ||
'type': 'array', | ||
'items': { | ||
'type': 'object', | ||
'properties': { | ||
'name': { 'type': 'string' }, | ||
'value': { 'type': 'string' } | ||
} | ||
} | ||
} | ||
} | ||
@@ -83,3 +103,13 @@ }, | ||
'foo': { 'type': 'string' }, | ||
'bar': { 'type': 'number' } | ||
'bar': { 'type': 'number' }, | ||
'list': { | ||
'type': 'array', | ||
'items': { | ||
'type': 'object', | ||
'properties': { | ||
'name': { 'type': 'string' }, | ||
'value': { 'type': 'string' } | ||
} | ||
} | ||
} | ||
} | ||
@@ -113,2 +143,6 @@ }, | ||
foo: 'FOO', | ||
list: [{ | ||
name: 'name', | ||
value: 'foo' | ||
}], | ||
bar: 42, | ||
@@ -141,3 +175,7 @@ hi: 'HI', | ||
foo: 'FOO', | ||
bar: 42 | ||
bar: 42, | ||
list: [{ | ||
name: 'name', | ||
value: 'foo' | ||
}] | ||
}) | ||
@@ -144,0 +182,0 @@ const greetingOutput = JSON.stringify({ |
@@ -23,3 +23,3 @@ 'use strict' | ||
let obj = { str: 'test', foo: 42, ofoo: true, foof: 'string', objfoo: {a: true}, notMe: false } | ||
let obj = { str: 'test', foo: 42, ofoo: true, foof: 'string', objfoo: { a: true }, notMe: false } | ||
t.equal(stringify(obj), '{"foo":"42","ofoo":"true","foof":"string","objfoo":"[object Object]","str":"test"}') | ||
@@ -26,0 +26,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
95105
3596
Updatedajv@^6.5.3