fast-json-stringify 2.2.9 → 2.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/stale.yml +21 -0
- package/index.js +1 -1
- package/package.json +2 -2
- package/test/anyof.test.js +30 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
|
2
|
+
daysUntilStale: 15
|
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
|
4
|
+
daysUntilClose: 7
|
|
5
|
+
# Issues with these labels will never be considered stale
|
|
6
|
+
exemptLabels:
|
|
7
|
+
- "discussion"
|
|
8
|
+
- "feature request"
|
|
9
|
+
- "bug"
|
|
10
|
+
- "help wanted"
|
|
11
|
+
- "plugin suggestion"
|
|
12
|
+
- "good first issue"
|
|
13
|
+
# Label to use when marking an issue as stale
|
|
14
|
+
staleLabel: stale
|
|
15
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
16
|
+
markComment: >
|
|
17
|
+
This issue has been automatically marked as stale because it has not had
|
|
18
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
|
19
|
+
for your contributions.
|
|
20
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
21
|
+
closeComment: false
|
package/index.js
CHANGED
|
@@ -1159,7 +1159,7 @@ function nested (laterCode, name, key, location, subKey, isArray) {
|
|
|
1159
1159
|
// 2. `nested`, through `buildCode`, replaces any reference in object properties with the actual schema
|
|
1160
1160
|
// (see https://github.com/fastify/fast-json-stringify/blob/6da3b3e8ac24b1ca5578223adedb4083b7adf8db/index.js#L631)
|
|
1161
1161
|
code += `
|
|
1162
|
-
${index === 0 ? 'if' : 'else if'}(ajv.validate(${
|
|
1162
|
+
${index === 0 ? 'if' : 'else if'}(ajv.validate(${JSON.stringify(location.schema)}, obj${accessor}))
|
|
1163
1163
|
${nestedResult.code}
|
|
1164
1164
|
`
|
|
1165
1165
|
laterCode = nestedResult.laterCode
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fast-json-stringify",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.10",
|
|
4
4
|
"description": "Stringify your JSON at max speed",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"pre-commit": "^1.2.2",
|
|
39
39
|
"proxyquire": "^2.1.3",
|
|
40
40
|
"semver": "^7.1.0",
|
|
41
|
-
"standard": "^
|
|
41
|
+
"standard": "^16.0.1",
|
|
42
42
|
"tap": "^14.0.0",
|
|
43
43
|
"typescript": "^4.0.2"
|
|
44
44
|
},
|
package/test/anyof.test.js
CHANGED
|
@@ -197,6 +197,36 @@ test('null value in schema', (t) => {
|
|
|
197
197
|
build(schema)
|
|
198
198
|
})
|
|
199
199
|
|
|
200
|
+
test('symbol value in schema', (t) => {
|
|
201
|
+
t.plan(4)
|
|
202
|
+
|
|
203
|
+
const ObjectKind = Symbol('LiteralKind')
|
|
204
|
+
const UnionKind = Symbol('UnionKind')
|
|
205
|
+
const LiteralKind = Symbol('LiteralKind')
|
|
206
|
+
|
|
207
|
+
const schema = {
|
|
208
|
+
kind: ObjectKind,
|
|
209
|
+
type: 'object',
|
|
210
|
+
properties: {
|
|
211
|
+
value: {
|
|
212
|
+
kind: UnionKind,
|
|
213
|
+
anyOf: [
|
|
214
|
+
{ kind: LiteralKind, type: 'string', enum: ['foo'] },
|
|
215
|
+
{ kind: LiteralKind, type: 'string', enum: ['bar'] },
|
|
216
|
+
{ kind: LiteralKind, type: 'string', enum: ['baz'] }
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
required: ['value']
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const stringify = build(schema)
|
|
224
|
+
t.is(stringify({ value: 'foo' }), '{"value":"foo"}')
|
|
225
|
+
t.is(stringify({ value: 'bar' }), '{"value":"bar"}')
|
|
226
|
+
t.is(stringify({ value: 'baz' }), '{"value":"baz"}')
|
|
227
|
+
t.is(stringify({ value: 'qux' }), '{"value":null}')
|
|
228
|
+
})
|
|
229
|
+
|
|
200
230
|
test('anyOf and $ref together', (t) => {
|
|
201
231
|
t.plan(2)
|
|
202
232
|
|