fast-json-stringify
Advanced tools
Comparing version 2.5.3 to 2.5.4
14
index.js
@@ -228,3 +228,15 @@ 'use strict' | ||
const str = JSON.stringify(schema) | ||
return (/"if":{.*"then":{|"(anyOf|oneOf)":\[|"const":/.test(str)) | ||
switch (true) { | ||
case /"if":{.*"then":{/.test(str): | ||
case /"(anyOf|oneOf)":\[/.test(str): | ||
case /"const"/.test(str): | ||
case /"\$ref"/.test(str): | ||
{ | ||
return true | ||
} | ||
default: { | ||
return false | ||
} | ||
} | ||
} | ||
@@ -231,0 +243,0 @@ |
{ | ||
"name": "fast-json-stringify", | ||
"version": "2.5.3", | ||
"version": "2.5.4", | ||
"description": "Stringify your JSON at max speed", | ||
@@ -43,3 +43,3 @@ "main": "index.js", | ||
"standard": "^16.0.1", | ||
"tap": "^14.0.0", | ||
"tap": "^15.0.0", | ||
"typescript": "^4.0.2" | ||
@@ -46,0 +46,0 @@ }, |
@@ -47,3 +47,3 @@ 'use strict' | ||
} catch (e) { | ||
t.is(e.message, '"name" is required!') | ||
t.equal(e.message, '"name" is required!') | ||
} | ||
@@ -56,6 +56,6 @@ | ||
} catch (e) { | ||
t.is(e.message, '"id" is required!') | ||
t.equal(e.message, '"id" is required!') | ||
} | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
id: 1, | ||
@@ -65,3 +65,3 @@ name: 'string' | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
id: 1, | ||
@@ -98,3 +98,3 @@ name: 'string', | ||
}) | ||
t.is(value, '{"id":1}') | ||
t.equal(value, '{"id":1}') | ||
}) | ||
@@ -115,3 +115,3 @@ | ||
} catch (e) { | ||
t.is(e.message, 'schema is invalid: data.allOf should NOT have fewer than 1 items') | ||
t.equal(e.message, 'schema is invalid: data.allOf should NOT have fewer than 1 items') | ||
} | ||
@@ -168,3 +168,3 @@ }) | ||
}) | ||
t.is(value, '{"id1":1,"id2":2,"id3":3}') | ||
t.equal(value, '{"id1":1,"id2":2,"id3":3}') | ||
}) | ||
@@ -200,3 +200,3 @@ | ||
}) | ||
t.is(value, '{"id1":1}') | ||
t.equal(value, '{"id1":1}') | ||
}) | ||
@@ -241,3 +241,3 @@ | ||
}) | ||
t.is(value, '{"id1":1,"id2":2}') | ||
t.equal(value, '{"id1":1,"id2":2}') | ||
}) | ||
@@ -285,3 +285,3 @@ | ||
}) | ||
t.is(value, '{"id1":1,"id2":2}') | ||
t.equal(value, '{"id1":1,"id2":2}') | ||
}) | ||
@@ -337,3 +337,3 @@ | ||
}) | ||
t.is(value, '{"id1":1,"id2":2}') | ||
t.equal(value, '{"id1":1,"id2":2}') | ||
}) |
@@ -19,15 +19,15 @@ 'use strict' | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
id: 1, name: 'string' | ||
}), '{"id":1,"name":"string"}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
id: 1, name: { first: 'name', last: 'last' } | ||
}), '{"id":1,"name":{"first":"name","last":"last"}}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
id: 1, name: null | ||
}), '{"id":1,"name":null}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
id: 1, name: ['first', 'last'] | ||
@@ -49,3 +49,3 @@ }), '{"id":1,"name":["first","last"]}') | ||
const stringify = build(schema) | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
name: 'string' | ||
@@ -66,3 +66,3 @@ }), '{"name":"string"}') | ||
const value = stringify([1, 'string', null]) | ||
t.is(value, '[1,"string",null]') | ||
t.equal(value, '[1,"string",null]') | ||
}) | ||
@@ -77,9 +77,9 @@ | ||
t.is(stringify(null), 'null') | ||
t.is(stringify(1), '1') | ||
t.is(stringify(true), 'true') | ||
t.is(stringify('hello'), '"hello"') | ||
t.is(stringify({}), '{}') | ||
t.is(stringify({ x: 10 }), '{"x":10}') | ||
t.is(stringify([true, 1, 'hello']), '[true,1,"hello"]') | ||
t.equal(stringify(null), 'null') | ||
t.equal(stringify(1), '1') | ||
t.equal(stringify(true), 'true') | ||
t.equal(stringify('hello'), '"hello"') | ||
t.equal(stringify({}), '{}') | ||
t.equal(stringify({ x: 10 }), '{"x":10}') | ||
t.equal(stringify([true, 1, 'hello']), '[true,1,"hello"]') | ||
}) | ||
@@ -99,9 +99,9 @@ | ||
t.is(stringify({ x: null }), '{"x":null}') | ||
t.is(stringify({ x: 1 }), '{"x":1}') | ||
t.is(stringify({ x: true }), '{"x":true}') | ||
t.is(stringify({ x: 'hello' }), '{"x":"hello"}') | ||
t.is(stringify({ x: {} }), '{"x":{}}') | ||
t.is(stringify({ x: { x: 10 } }), '{"x":{"x":10}}') | ||
t.is(stringify({ x: [true, 1, 'hello'] }), '{"x":[true,1,"hello"]}') | ||
t.equal(stringify({ x: null }), '{"x":null}') | ||
t.equal(stringify({ x: 1 }), '{"x":1}') | ||
t.equal(stringify({ x: true }), '{"x":true}') | ||
t.equal(stringify({ x: 'hello' }), '{"x":"hello"}') | ||
t.equal(stringify({ x: {} }), '{"x":{}}') | ||
t.equal(stringify({ x: { x: 10 } }), '{"x":{"x":10}}') | ||
t.equal(stringify({ x: [true, 1, 'hello'] }), '{"x":[true,1,"hello"]}') | ||
}) | ||
@@ -119,3 +119,3 @@ | ||
t.is(stringify([1, true, 'hello', [], { x: 1 }]), '[1,true,"hello",[],{"x":1}]') | ||
t.equal(stringify([1, true, 'hello', [], { x: 1 }]), '[1,true,"hello",[],{"x":1}]') | ||
}) | ||
@@ -156,6 +156,6 @@ | ||
t.is(stringify({ kind: 'Bar', value: 1 }), '{"kind":"Bar","value":1}') | ||
t.is(stringify({ kind: 'Foo', value: 1 }), '{"kind":"Foo","value":1}') | ||
t.is(stringify({ kind: 'Foo', value: true }), '{"kind":"Foo","value":true}') | ||
t.is(stringify({ kind: 'Foo', value: 'hello' }), '{"kind":"Foo","value":"hello"}') | ||
t.equal(stringify({ kind: 'Bar', value: 1 }), '{"kind":"Bar","value":1}') | ||
t.equal(stringify({ kind: 'Foo', value: 1 }), '{"kind":"Foo","value":1}') | ||
t.equal(stringify({ kind: 'Foo', value: true }), '{"kind":"Foo","value":true}') | ||
t.equal(stringify({ kind: 'Foo', value: 'hello' }), '{"kind":"Foo","value":"hello"}') | ||
}) |
@@ -24,7 +24,7 @@ 'use strict' | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
str: 'string' | ||
}), '{"str":"string"}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
str: true | ||
@@ -57,7 +57,7 @@ }), '{"str":true}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
prop: null | ||
}), '{"prop":null}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
prop: { | ||
@@ -92,3 +92,3 @@ str: 'string' | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
prop: { | ||
@@ -99,3 +99,3 @@ str: 'string' | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
prop: ['string'] | ||
@@ -124,3 +124,3 @@ }), '{"prop":["string"]}') | ||
}) | ||
t.is(value, '{"str":null}') | ||
t.equal(value, '{"str":null}') | ||
}) | ||
@@ -153,3 +153,3 @@ | ||
}) | ||
t.is(value, '{"str":"1"}') | ||
t.equal(value, '{"str":"1"}') | ||
}) | ||
@@ -188,5 +188,5 @@ | ||
t.is(stringify({ anyOfSchema: { baz: 5 } }), '{"anyOfSchema":{"baz":5}}') | ||
t.equal(stringify({ anyOfSchema: { baz: 5 } }), '{"anyOfSchema":{"baz":5}}') | ||
t.is(stringify({ anyOfSchema: { bar: 'foo' } }), '{"anyOfSchema":{"bar":"foo"}}') | ||
t.equal(stringify({ anyOfSchema: { bar: 'foo' } }), '{"anyOfSchema":{"bar":"foo"}}') | ||
}) | ||
@@ -231,6 +231,6 @@ | ||
const stringify = build(schema) | ||
t.is(stringify({ value: 'foo' }), '{"value":"foo"}') | ||
t.is(stringify({ value: 'bar' }), '{"value":"bar"}') | ||
t.is(stringify({ value: 'baz' }), '{"value":"baz"}') | ||
t.is(stringify({ value: 'qux' }), '{"value":null}') | ||
t.equal(stringify({ value: 'foo' }), '{"value":"foo"}') | ||
t.equal(stringify({ value: 'bar' }), '{"value":"bar"}') | ||
t.equal(stringify({ value: 'baz' }), '{"value":"baz"}') | ||
t.equal(stringify({ value: 'qux' }), '{"value":null}') | ||
}) | ||
@@ -264,5 +264,5 @@ | ||
t.is(stringify({ cs: 'franco' }), '{"cs":"franco"}') | ||
t.equal(stringify({ cs: 'franco' }), '{"cs":"franco"}') | ||
t.is(stringify({ cs: true }), '{"cs":true}') | ||
t.equal(stringify({ cs: true }), '{"cs":true}') | ||
}) | ||
@@ -303,3 +303,3 @@ | ||
const value = stringify({ cs: 3 }) | ||
t.is(value, '{"cs":3}') | ||
t.equal(value, '{"cs":3}') | ||
}) | ||
@@ -343,5 +343,5 @@ | ||
t.is(stringify({ cs: 3 }), '{"cs":3}') | ||
t.is(stringify({ cs: true }), '{"cs":true}') | ||
t.is(stringify({ cs: 'pippo' }), '{"cs":"pippo"}') | ||
t.equal(stringify({ cs: 3 }), '{"cs":3}') | ||
t.equal(stringify({ cs: true }), '{"cs":true}') | ||
t.equal(stringify({ cs: 'pippo' }), '{"cs":"pippo"}') | ||
}) | ||
@@ -437,3 +437,3 @@ | ||
const value = stringify([{ savedId: 'great' }, { error: 'oops' }]) | ||
t.is(value, '[{"savedId":"great"},{"error":"oops"}]') | ||
t.equal(value, '[{"savedId":"great"},{"error":"oops"}]') | ||
}) | ||
@@ -460,3 +460,3 @@ | ||
const value = stringify(['EUR', 'USD', null]) | ||
t.is(value, '["EUR","USD",null]') | ||
t.equal(value, '["EUR","USD",null]') | ||
}) |
@@ -16,3 +16,3 @@ 'use strict' | ||
t.deepEqual(JSON.parse(output), toStringify) | ||
t.same(JSON.parse(output), toStringify) | ||
t.equal(output, JSON.stringify(toStringify)) | ||
@@ -199,3 +199,3 @@ t.ok(validate(JSON.parse(output)), 'valid schema') | ||
}) | ||
t.is(value, '{"times":["2018-04-21T07:52:31.017Z"]}') | ||
t.equal(value, '{"times":["2018-04-21T07:52:31.017Z"]}') | ||
}) | ||
@@ -259,3 +259,3 @@ | ||
]) | ||
t.is(value, '[{"name":"name-0","option":"Foo"},{"name":"name-1","option":"Bar"}]') | ||
t.equal(value, '[{"name":"name-0","option":"Foo"},{"name":"name-1","option":"Bar"}]') | ||
}) |
@@ -15,3 +15,3 @@ 'use strict' | ||
t.deepEqual(JSON.parse(output), toStringify) | ||
t.same(JSON.parse(output), toStringify) | ||
t.equal(output, JSON.stringify(toStringify)) | ||
@@ -284,3 +284,3 @@ t.ok(validate(JSON.parse(output)), 'valid schema') | ||
t.deepEqual(JSON.parse(result), {}) | ||
t.same(JSON.parse(result), {}) | ||
@@ -292,3 +292,3 @@ result = stringify({ | ||
t.deepEqual(JSON.parse(result), { age: 42, distance: 1 }) | ||
t.same(JSON.parse(result), { age: 42, distance: 1 }) | ||
t.end() | ||
@@ -295,0 +295,0 @@ }) |
@@ -23,3 +23,3 @@ 'use strict' | ||
t.type(debugMode, Array) | ||
t.like(debugMode.toString.toString(), 'join', 'to string override') | ||
t.match(debugMode.toString.toString(), 'join', 'to string override') | ||
}) | ||
@@ -31,3 +31,3 @@ | ||
t.type(debugMode, Array) | ||
t.like(debugMode.toString.toString(), 'join', 'to string override') | ||
t.match(debugMode.toString.toString(), 'join', 'to string override') | ||
}) | ||
@@ -43,3 +43,3 @@ | ||
const tobe = JSON.stringify({ firstName: 'Foo' }) | ||
t.deepEquals(compiled({ firstName: 'Foo', surname: 'bar' }), tobe, 'surname evicted') | ||
t.same(compiled({ firstName: 'Foo', surname: 'bar' }), tobe, 'surname evicted') | ||
}) | ||
@@ -67,3 +67,3 @@ | ||
const tobe = JSON.stringify({ str: 'Foo' }) | ||
t.deepEquals(compiled({ str: 'Foo', void: 'me' }), tobe) | ||
t.same(compiled({ str: 'Foo', void: 'me' }), tobe) | ||
}) |
@@ -14,3 +14,3 @@ 'use strict' | ||
t.strictEqual(output, JSON.stringify(expected)) | ||
t.equal(output, JSON.stringify(expected)) | ||
}) | ||
@@ -17,0 +17,0 @@ } |
@@ -15,3 +15,3 @@ 'use strict' | ||
t.deepEqual(JSON.parse(output), toStringify) | ||
t.same(JSON.parse(output), toStringify) | ||
t.equal(output, JSON.stringify(toStringify)) | ||
@@ -18,0 +18,0 @@ t.ok(validate(JSON.parse(output)), 'valid schema') |
@@ -35,3 +35,3 @@ 'use strict' | ||
t.ok(error) | ||
t.equals(error.message, 'Unsupported integer rounding method foobar') | ||
t.equal(error.message, 'Unsupported integer rounding method foobar') | ||
} | ||
@@ -38,0 +38,0 @@ }) |
@@ -31,3 +31,3 @@ 'use strict' | ||
}) | ||
t.is(value, '{"stringProperty":"string1","objectProperty":{"stringProperty":"string2","numberProperty":42}}') | ||
t.equal(value, '{"stringProperty":"string1","objectProperty":{"stringProperty":"string2","numberProperty":42}}') | ||
}) |
@@ -111,4 +111,4 @@ 'use strict' | ||
const result = stringifier(data) | ||
t.deepEqual(JSON.parse(result), expected) | ||
t.same(JSON.parse(result), expected) | ||
}) | ||
}) |
@@ -24,4 +24,4 @@ 'use strict' | ||
t.is(stringify({ str: 'string' }), '{"str":"string"}') | ||
t.is(stringify({ str: true }), '{"str":true}') | ||
t.equal(stringify({ str: 'string' }), '{"str":"string"}') | ||
t.equal(stringify({ str: true }), '{"str":true}') | ||
}) | ||
@@ -52,5 +52,5 @@ | ||
t.is(stringify({ prop: null }), '{"prop":null}') | ||
t.equal(stringify({ prop: null }), '{"prop":null}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
prop: { | ||
@@ -85,7 +85,7 @@ str: 'string', remove: 'this' | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
prop: { str: 'string' } | ||
}), '{"prop":{"str":"string"}}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
prop: ['string'] | ||
@@ -114,3 +114,3 @@ }), '{"prop":["string"]}') | ||
}) | ||
t.is(value, '{"str":null}') | ||
t.equal(value, '{"str":null}') | ||
}) | ||
@@ -143,3 +143,3 @@ | ||
}) | ||
t.is(value, '{"str":"1"}') | ||
t.equal(value, '{"str":"1"}') | ||
}) | ||
@@ -178,5 +178,5 @@ | ||
t.is(stringify({ oneOfSchema: { baz: 5 } }), '{"oneOfSchema":{"baz":5}}') | ||
t.equal(stringify({ oneOfSchema: { baz: 5 } }), '{"oneOfSchema":{"baz":5}}') | ||
t.is(stringify({ oneOfSchema: { bar: 'foo' } }), '{"oneOfSchema":{"bar":"foo"}}') | ||
t.equal(stringify({ oneOfSchema: { bar: 'foo' } }), '{"oneOfSchema":{"bar":"foo"}}') | ||
}) | ||
@@ -223,5 +223,5 @@ | ||
t.is(stringify({ cs: 'franco' }), '{"cs":"franco"}') | ||
t.equal(stringify({ cs: 'franco' }), '{"cs":"franco"}') | ||
t.is(stringify({ cs: true }), '{"cs":true}') | ||
t.equal(stringify({ cs: true }), '{"cs":true}') | ||
}) | ||
@@ -264,3 +264,3 @@ | ||
}) | ||
t.is(value, '{"cs":3}') | ||
t.equal(value, '{"cs":3}') | ||
}) | ||
@@ -304,5 +304,5 @@ | ||
t.is(stringify({ cs: 3 }), '{"cs":3}') | ||
t.is(stringify({ cs: true }), '{"cs":true}') | ||
t.is(stringify({ cs: 'pippo' }), '{"cs":"pippo"}') | ||
t.equal(stringify({ cs: 3 }), '{"cs":3}') | ||
t.equal(stringify({ cs: true }), '{"cs":true}') | ||
t.equal(stringify({ cs: 'pippo' }), '{"cs":"pippo"}') | ||
}) | ||
@@ -385,3 +385,3 @@ | ||
const value = stringify(['EUR', 'USD', null]) | ||
t.is(value, '["EUR","USD",null]') | ||
t.equal(value, '["EUR","USD",null]') | ||
}) |
@@ -1029,3 +1029,3 @@ 'use strict' | ||
} catch (err) { | ||
t.is(err.message, 'Cannot find reference "porjectId", did you mean "projectId"?') | ||
t.equal(err.message, 'Cannot find reference "porjectId", did you mean "projectId"?') | ||
} | ||
@@ -1055,3 +1055,3 @@ }) | ||
} catch (err) { | ||
t.is(err.message, 'Cannot find reference "foobar"') | ||
t.equal(err.message, 'Cannot find reference "foobar"') | ||
} | ||
@@ -1086,3 +1086,3 @@ }) | ||
} catch (err) { | ||
t.is(err.message, 'Cannot find reference "porjectId", did you mean "projectId"?') | ||
t.equal(err.message, 'Cannot find reference "porjectId", did you mean "projectId"?') | ||
} | ||
@@ -1117,3 +1117,3 @@ }) | ||
} catch (err) { | ||
t.is(err.message, 'Cannot find reference "foobar"') | ||
t.equal(err.message, 'Cannot find reference "foobar"') | ||
} | ||
@@ -1148,3 +1148,3 @@ }) | ||
} catch (err) { | ||
t.is(err.message, 'Cannot find reference "deifnitions", did you mean "definitions"?') | ||
t.equal(err.message, 'Cannot find reference "deifnitions", did you mean "definitions"?') | ||
} | ||
@@ -1174,3 +1174,3 @@ }) | ||
} catch (err) { | ||
t.is(err.message, 'Cannot find reference "deifnitions", did you mean "definitions"?') | ||
t.equal(err.message, 'Cannot find reference "deifnitions", did you mean "definitions"?') | ||
} | ||
@@ -1205,3 +1205,3 @@ }) | ||
} catch (err) { | ||
t.is(err.message, 'Cannot find reference "extrenal", did you mean "external"?') | ||
t.equal(err.message, 'Cannot find reference "extrenal", did you mean "external"?') | ||
} | ||
@@ -1208,0 +1208,0 @@ }) |
@@ -35,3 +35,3 @@ 'use strict' | ||
} catch (e) { | ||
t.is(e.message, '"str" is required!') | ||
t.equal(e.message, '"str" is required!') | ||
t.pass() | ||
@@ -60,3 +60,3 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"str" is required!') | ||
t.equal(e.message, '"str" is required!') | ||
t.pass() | ||
@@ -71,3 +71,3 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"str" is required!') | ||
t.equal(e.message, '"str" is required!') | ||
t.pass() | ||
@@ -97,3 +97,3 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"str" is required!') | ||
t.equal(e.message, '"str" is required!') | ||
t.pass() | ||
@@ -108,3 +108,3 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"str" is required!') | ||
t.equal(e.message, '"str" is required!') | ||
t.pass() | ||
@@ -134,3 +134,3 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"num" is required!') | ||
t.equal(e.message, '"num" is required!') | ||
t.pass() | ||
@@ -145,3 +145,3 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"key1" is required!') | ||
t.equal(e.message, '"key1" is required!') | ||
t.pass() | ||
@@ -157,3 +157,3 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"key2" is required!') | ||
t.equal(e.message, '"key2" is required!') | ||
t.pass() | ||
@@ -183,3 +183,3 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"bool" is required!') | ||
t.equal(e.message, '"bool" is required!') | ||
t.pass() | ||
@@ -244,5 +244,5 @@ } | ||
} catch (e) { | ||
t.is(e.message, '"num" is required!') | ||
t.equal(e.message, '"num" is required!') | ||
t.pass() | ||
} | ||
}) |
@@ -108,3 +108,3 @@ 'use strict' | ||
t.deepEqual(JSON.parse(stringify2({ | ||
t.same(JSON.parse(stringify2({ | ||
'"\'phra////': 42, | ||
@@ -139,3 +139,3 @@ asd: 42 | ||
t.deepEqual(JSON.parse(stringify4({})), { | ||
t.same(JSON.parse(stringify4({})), { | ||
'"\\\\\\\\\'w00t': '"\'w00t' | ||
@@ -142,0 +142,0 @@ }) |
@@ -35,4 +35,4 @@ 'use strict' | ||
const value = stringify({ people: { name: 'hello', foo: 'bar' } }) | ||
t.is(value, '{"people":{"name":"hello"}}') | ||
t.deepEqual(schema, clonedSchema) | ||
t.equal(value, '{"people":{"name":"hello"}}') | ||
t.same(schema, clonedSchema) | ||
}) | ||
@@ -81,3 +81,3 @@ | ||
t.equal(valueAny2, '{"people":{"name":"hello"},"love":true}') | ||
t.deepEqual(schema, clonedSchema) | ||
t.same(schema, clonedSchema) | ||
}) | ||
@@ -123,4 +123,4 @@ | ||
const value = stringify({ people: { name: 'hello', foo: 'bar', age: 42 } }) | ||
t.is(value, '{"people":{"name":"hello","age":42}}') | ||
t.deepEqual(schema, clonedSchema) | ||
t.equal(value, '{"people":{"name":"hello","age":42}}') | ||
t.same(schema, clonedSchema) | ||
}) | ||
@@ -158,4 +158,4 @@ | ||
const value = stringify([{ name: 'foo' }]) | ||
t.is(value, '[{"name":"foo"}]') | ||
t.deepEqual(schema, clonedSchema) | ||
t.equal(value, '[{"name":"foo"}]') | ||
t.same(schema, clonedSchema) | ||
}) |
@@ -25,3 +25,3 @@ 'use strict' | ||
}) | ||
t.is(value, '{"data":4}') | ||
t.equal(value, '{"data":4}') | ||
}) | ||
@@ -47,3 +47,3 @@ | ||
}) | ||
t.is(value, '{"data":4}') | ||
t.equal(value, '{"data":4}') | ||
}) | ||
@@ -69,3 +69,3 @@ | ||
}) | ||
t.is(value, '{"data":0}') | ||
t.equal(value, '{"data":0}') | ||
}) | ||
@@ -91,3 +91,3 @@ | ||
}) | ||
t.is(value, '{"data":0}') | ||
t.equal(value, '{"data":0}') | ||
}) | ||
@@ -113,3 +113,3 @@ | ||
}) | ||
t.is(value, '{"data":4}') | ||
t.equal(value, '{"data":4}') | ||
}) | ||
@@ -135,3 +135,3 @@ | ||
}) | ||
t.is(value, '{"data":4}') | ||
t.equal(value, '{"data":4}') | ||
}) | ||
@@ -157,3 +157,3 @@ | ||
}) | ||
t.is(value, '{"data":null}') | ||
t.equal(value, '{"data":null}') | ||
}) | ||
@@ -179,3 +179,3 @@ | ||
}) | ||
t.is(value, '{"data":null}') | ||
t.equal(value, '{"data":null}') | ||
}) | ||
@@ -202,3 +202,3 @@ | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
objectOrNull: { | ||
@@ -209,3 +209,3 @@ stringOrNumber: 'string' | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
objectOrNull: { | ||
@@ -216,3 +216,3 @@ stringOrNumber: 42 | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
objectOrNull: null | ||
@@ -243,3 +243,3 @@ }), '{"objectOrNull":null}') | ||
}) | ||
t.is(value, '{"arrayOfStringsAndNumbers":null}') | ||
t.equal(value, '{"arrayOfStringsAndNumbers":null}') | ||
} catch (e) { | ||
@@ -254,3 +254,3 @@ console.log(e) | ||
}) | ||
t.is(value, '{"arrayOfStringsAndNumbers":["string1","string2"]}') | ||
t.equal(value, '{"arrayOfStringsAndNumbers":["string1","string2"]}') | ||
} catch (e) { | ||
@@ -261,11 +261,11 @@ console.log(e) | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
arrayOfStringsAndNumbers: [42, 7] | ||
}), '{"arrayOfStringsAndNumbers":[42,7]}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
arrayOfStringsAndNumbers: ['string1', 42, 7, 'string2'] | ||
}), '{"arrayOfStringsAndNumbers":["string1",42,7,"string2"]}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
arrayOfStringsAndNumbers: ['string1', null, 42, 7, 'string2', null] | ||
@@ -304,3 +304,3 @@ }), '{"arrayOfStringsAndNumbers":["string1",null,42,7,"string2",null]}') | ||
}) | ||
t.is(value, '{"fixedTupleOfStringsAndNumbers":["string1",42,7]}') | ||
t.equal(value, '{"fixedTupleOfStringsAndNumbers":["string1",42,7]}') | ||
} catch (e) { | ||
@@ -315,3 +315,3 @@ console.log(e) | ||
}) | ||
t.is(value, '{"fixedTupleOfStringsAndNumbers":["string1",42,"string2"]}') | ||
t.equal(value, '{"fixedTupleOfStringsAndNumbers":["string1",42,"string2"]}') | ||
} catch (e) { | ||
@@ -353,3 +353,3 @@ console.log(e) | ||
}) | ||
t.is(value, '{"objectOrBoolean":{"stringOrNumber":"string"}}') | ||
t.equal(value, '{"objectOrBoolean":{"stringOrNumber":"string"}}') | ||
} catch (e) { | ||
@@ -360,7 +360,7 @@ console.log(e) | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
objectOrBoolean: { stringOrNumber: 42 } | ||
}), '{"objectOrBoolean":{"stringOrNumber":42}}') | ||
t.is(stringify({ | ||
t.equal(stringify({ | ||
objectOrBoolean: true | ||
@@ -384,3 +384,3 @@ }), '{"objectOrBoolean":true}') | ||
}) | ||
t.is(value, '{"date":"2018-04-20T07:52:31.017Z","dateObject":"2018-04-21T07:52:31.017Z"}') | ||
t.equal(value, '{"date":"2018-04-20T07:52:31.017Z","dateObject":"2018-04-21T07:52:31.017Z"}') | ||
}) | ||
@@ -408,6 +408,6 @@ | ||
const valueStr = stringify({ simultaneously: likeObjectId }) | ||
t.is(valueStr, '{"simultaneously":"hello"}') | ||
t.equal(valueStr, '{"simultaneously":"hello"}') | ||
const valueObj = stringify({ simultaneously: { foo: likeObjectId } }) | ||
t.is(valueObj, '{"simultaneously":{"foo":"hello"}}') | ||
t.equal(valueObj, '{"simultaneously":{"foo":"hello"}}') | ||
}) | ||
@@ -435,6 +435,6 @@ | ||
const valueStr = stringify({ simultaneously: likeObjectId }) | ||
t.is(valueStr, '{"simultaneously":{}}') | ||
t.equal(valueStr, '{"simultaneously":{}}') | ||
const valueObj = stringify({ simultaneously: { foo: likeObjectId } }) | ||
t.is(valueObj, '{"simultaneously":{"foo":"hello"}}') | ||
t.equal(valueObj, '{"simultaneously":{"foo":"hello"}}') | ||
}) | ||
@@ -441,0 +441,0 @@ |
Sorry, the diff of this file is not supported yet
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
327773
62
9868