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__ is significantly faster than `JSON.stringify()` for small payloads. Its performance advantage shrinks as your payload grows. It pairs well with [__flatstr__](https://www.npmjs.com/package/flatstr), which triggers a V8 optimization that improves performance when eventually converting the string to a `Buffer`.
@@ -105,11 +105,34 @@ And nested ones, too.
105
105
<aname="specific"></a>
106
106
#### Specific use cases
107
107
108
-
| Instance | Serialized as |
109
-
| -----------|------------------------------|
110
-
|`Date`|`string` via `toISOString()`|
111
-
|`RegExp`|`string`|
112
-
|`BigInt`|`integer` via `toString`|
108
+
| Instance | Serialized as |
109
+
| -------- | ---------------------------- |
110
+
|`Date`|`string` via `toISOString()`|
111
+
|`RegExp`|`string`|
112
+
|`BigInt`|`integer` via `toString`|
113
+
114
+
[JSON Schema built-in formats](https://json-schema.org/understanding-json-schema/reference/string.html#built-in-formats) for dates are supported and will be serialized as:
115
+
116
+
| Format | Serialized format example |
117
+
| ----------- | -------------------------- |
118
+
|`date-time`|`2020-04-03T09:11:08.615Z`|
119
+
|`date`|`2020-04-03`|
120
+
|`time`|`09:11:08`|
121
+
122
+
Example with a MomentJS object:
123
+
124
+
```javascript
125
+
constmoment=require('moment')
126
+
127
+
conststringify=fastJson({
128
+
title:'Example Schema with string date-time field',
By default the library will handle automatically [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) from Node.js v10.3 and above.
470
+
By default the library will handle automatically [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) from Node.js v10.3 and above.
448
471
If you can't use BigInts in your environment, long integers (64-bit) are also supported using the [long](https://github.com/dcodeIO/long.js) module.
0 commit comments