Skip to content

Commit 01cb13a

Browse files
authored
add options paragraph (#285)
1 parent 735b384 commit 01cb13a

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ fast-json-stringify obj x 13,537,123 ops/sec ±0.19% (95 runs sampled)
3030

3131
#### Table of contents:
3232
- <a href="#example">`Example`</a>
33+
- <a href="#options">`Options`</a>
3334
- <a href="#api">`API`</a>
3435
- <a href="#fastJsonStringify">`fastJsonStringify`</a>
3536
- <a href="#specific">`Specific use cases`</a>
@@ -79,13 +80,32 @@ console.log(stringify({
7980
reg: /"([^"]|\\")*"/
8081
}))
8182
```
83+
84+
<a name="options"></a>
85+
## Options
86+
87+
Optionally, you may provide to `fast-json-stringify` an option object as second parameter:
88+
89+
```js
90+
const fastJson = require('fast-json-stringify')
91+
const stringify = fastJson(mySchema, {
92+
schema: { ... },
93+
ajv: { ... },
94+
rounding: 'ceil'
95+
})
96+
```
97+
98+
- `schema`: external schemas references by $ref property. [More details](#ref)
99+
- `ajv`: ajv instance's settings for those properties that require `ajv`. [More details](#anyof)
100+
- `rounding`: setup how the `integer` types will be rounded when not integers. [More details](#integer)
101+
102+
82103
<a name="api"></a>
83104
## API
84105
<a name="fastJsonStringify"></a>
85106
### fastJsonStringify(schema)
86107

87-
Build a `stringify()` function based on
88-
[jsonschema](http://json-schema.org/).
108+
Build a `stringify()` function based on [jsonschema](http://json-schema.org/).
89109

90110
Supported types:
91111

0 commit comments

Comments
 (0)