You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`fast-json-stringify` supports additional properties as defined inside JSON schema.
201
+
`fast-json-stringify` supports additional properties as defined by JSON schema.
204
202
*additionalProperties* must be an object or a boolean, declared in this way: `{ type: 'type' }`.
205
203
*additionalProperties* will work only for the properties that are not explicitly listed in the *properties* and *patternProperties* objects.
206
204
207
-
If *additionalProperties* is not present or is setted to false, every property that is not explicitly listed in the *properties* and *patternProperties* objects,will be ignored, as said in <ahref="#missingFields">Missing fields</a>.
208
-
If *additionalProperties* is setted to *true*, it will be used `fast-safe-stringify` to stringify the additional properties. If you want to achieve maximum performances we strongly encourage you to use a fixed schema where possible.
205
+
If *additionalProperties* is not present or is set to `false`, every property that is not explicitly listed in the *properties* and *patternProperties* objects,will be ignored, as described in <ahref="#missingFields">Missing fields</a>.
206
+
If *additionalProperties* is set to `true`, it will be used by `fast-safe-stringify` to stringify the additional properties. If you want to achieve maximum performance, we strongly encourage you to use a fixed schema where possible.
`fast-json-stringify` supports anyOf keyword as defined inside JSON schema. *anyOf* must be an array of valid JSON schemas. The differents schemas will be tried in this order so `stringify`will be slower the farest the right type is from the start of the array.
244
+
`fast-json-stringify` supports the anyOf keyword as defined by JSON schema. *anyOf* must be an array of valid JSON schemas. The different schemas will be tested in the specified order. The more schemas `stringify`has to try before finding a match, the slower it will be.
247
245
248
-
*anyOf* uses [ajv](https://www.npmjs.com/package/ajv) as a JSON schema validator to find the schema that match the data and this has an impact on performances. Use it only as a last resort.
246
+
*anyOf* uses [ajv](https://www.npmjs.com/package/ajv) as a JSON schema validator to find the schema that matches the data. This has an impact on performance—only use it as a last resort.
249
247
250
248
Example:
251
249
```javascript
@@ -264,7 +262,7 @@ const stringify = fastJson({
264
262
}
265
263
```
266
264
267
-
This schema will accept a string or a boolean for the property `undecidedType`. If no schema match the data, it will be stringified as `null`.
265
+
This schema will accept a string or a boolean for the property `undecidedType`. If no schema matches the data, it will be stringified as `null`.
If you want to squeeze a little bit more performance out of the serialisation, at the cost of readability in the generated code, you can pass `uglify:true` as an option.
375
-
Note that you have to manually install `uglify-es` in order for it to work. Only version 3 is supported.
372
+
If you want to squeeze a little bit more performance out of the serialization at the cost of readability in the generated code, you can pass `uglify:true` as an option.
373
+
Note that you have to manually install `uglify-es` in order for this to work. Only version 3 is supported.
376
374
Example:
377
375
378
376
Note that if you are using Node 8.3.0 or newer, there are no performance gains from using Uglify. See https://www.nearform.com/blog/node-js-is-getting-a-new-v8-with-turbofan/
0 commit comments