fast-json-stringify
Advanced tools
Comparing version 2.3.0 to 2.3.1
@@ -8,3 +8,2 @@ 'use strict' | ||
var util = require('util') | ||
var validate = require('./schema-validator') | ||
@@ -838,3 +837,3 @@ var stringSimilarity = null | ||
code += ` | ||
valid = ajv.validate(${util.inspect(i, { depth: null })}, obj) | ||
valid = ajv.validate(${JSON.stringify(i)}, obj) | ||
if (valid) { | ||
@@ -841,0 +840,0 @@ ` |
{ | ||
"name": "fast-json-stringify", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "Stringify your JSON at max speed", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -212,1 +212,48 @@ 'use strict' | ||
}) | ||
// https://github.com/fastify/fast-json-stringify/issues/279 | ||
test('object array with anyOf and symbol', (t) => { | ||
t.plan(1) | ||
const ArrayKind = Symbol('ArrayKind') | ||
const ObjectKind = Symbol('LiteralKind') | ||
const UnionKind = Symbol('UnionKind') | ||
const LiteralKind = Symbol('LiteralKind') | ||
const StringKind = Symbol('StringKind') | ||
const schema = { | ||
kind: ArrayKind, | ||
type: 'array', | ||
items: { | ||
kind: ObjectKind, | ||
type: 'object', | ||
properties: { | ||
name: { | ||
kind: StringKind, | ||
type: 'string' | ||
}, | ||
option: { | ||
kind: UnionKind, | ||
anyOf: [ | ||
{ | ||
kind: LiteralKind, | ||
type: 'string', | ||
enum: ['Foo'] | ||
}, | ||
{ | ||
kind: LiteralKind, | ||
type: 'string', | ||
enum: ['Bar'] | ||
} | ||
] | ||
} | ||
}, | ||
required: ['name', 'option'] | ||
} | ||
} | ||
const stringify = build(schema) | ||
const value = stringify([ | ||
{ name: 'name-0', option: 'Foo' }, | ||
{ name: 'name-1', option: 'Bar' } | ||
]) | ||
t.is(value, '[{"name":"name-0","option":"Foo"},{"name":"name-1","option":"Bar"}]') | ||
}) |
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
313978
9425