Skip to content

Commit 4729fde

Browse files
committed
docs: Small improvements
[ci skip]
1 parent 161601a commit 4729fde

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Inspired by [`fast-json-stringify`](https://github.com/fastify/fast-json-stringi
1717
+ [`type`](#type)
1818
+ [`items`](#items)
1919
+ [`properties`](#properties)
20+
+ [Missing properties](#missing-properties)
2021
+ [`additionalProperties`](#additionalproperties)
2122
+ [Differences from `JSON.stringify()`](#differences-from-jsonstringify)
2223
+ [When type coercion is off](#when-type-coercion-is-off-the-default)
@@ -108,7 +109,7 @@ Example:
108109

109110
Defines the type(s) of data in an `array` type. It has 2 formats:
110111

111-
##### all-items format
112+
##### all items format
112113

113114
```js
114115
{
@@ -263,6 +264,8 @@ Make sure to always define all possible types for both safety and the best perfo
263264

264265
> **Note:** This option was originally implemented in an attempt to improve performance by avoiding extra type-checking and function calls, but the synthetic benchmark shows that this makes almost no difference to performance.
265266
267+
The same differences as when [type coercion is off](#when-type-coercion-is-off-the-default) plus the following:
268+
266269
The compiled function will coerce the received data into the defined type or it will throw an error if it cannot coerce the data (e.g. if `null` or `undefined` is stringified as an `object` type).
267270

268271
If multiple types are specified, the stringifier will attempt to match the data to one of the defined types (such as `1` to `number` or `true` to `boolean`). If no matching type is defined, the data will be coerced to the defined type that is the **lowest** on this list:

0 commit comments

Comments
 (0)