safe-stable-stringify
Advanced tools
Comparing version 2.1.0 to 2.2.0
# Changelog | ||
## v2.2.0 | ||
- Reduce module size by removing the test and benchmark files from the published package | ||
- Accept `undefined` as `circularValue` option to remove circular properties from the serialized output: | ||
```js | ||
import { configure } from 'safe-stable-stringify' | ||
const object = { array: [] } | ||
object.circular = object; | ||
object.array.push(object) | ||
configure({ circularValue: undefined })(object) | ||
// '{"array":[null]}' | ||
``` | ||
## v2.1.0 | ||
@@ -4,0 +20,0 @@ |
@@ -124,4 +124,6 @@ 'use strict' | ||
circularValue = `"${circularValue}"` | ||
} else if (circularValue === undefined) { | ||
return | ||
} else if (circularValue !== null) { | ||
throw new TypeError('The "circularValue" argument must be of type string or the value null') | ||
throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined') | ||
} | ||
@@ -128,0 +130,0 @@ } |
{ | ||
"name": "safe-stable-stringify", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Deterministic and safely JSON.stringify to quickly serialize JavaScript objects", | ||
@@ -21,3 +21,4 @@ "exports": { | ||
"repeatable", | ||
"fast" | ||
"fast", | ||
"bigint" | ||
], | ||
@@ -24,0 +25,0 @@ "main": "index.js", |
@@ -47,3 +47,5 @@ # safe-stable-stringify | ||
they are ignored. **Default:** `true`. | ||
* `circularValue` {string|null} Define the value for circular references. **Default:** `[Circular]`. | ||
* `circularValue` {string|null|undefined} Defines the value for circular | ||
references. Set to `undefined`, circular properties are not serialized (array | ||
entries are replaced with `null`). **Default:** `[Circular]`. | ||
* `deterministic` {boolean} If `true`, guarantee a deterministic key order | ||
@@ -95,6 +97,6 @@ instead of relying on the insertion order. **Default:** `true`. | ||
1. Replace circular structures with the string `[Circular]` (the value may be changed). | ||
1. Sorted keys instead of using the insertion order (it is possible to deactivate this). | ||
1. BigInt values are stringified as regular number instead of throwing a TypeError. | ||
1. Boxed primitives (e.g., `Number(5)`) are not unboxed and are handled as | ||
1. _Circular values_ are replaced with the string `[Circular]` (the value may be changed). | ||
1. _Object keys_ are sorted instead of using the insertion order (it is possible to deactivate this). | ||
1. _BigInt_ values are stringified as regular number instead of throwing a TypeError. | ||
1. _Boxed primitives_ (e.g., `Number(5)`) are not unboxed and are handled as | ||
regular object. | ||
@@ -108,4 +110,4 @@ | ||
Currently this is by far the fastest known stable stringify implementation. | ||
This is especially important for big objects and TypedArrays. | ||
Currently this is by far the fastest known stable (deterministic) stringify | ||
implementation. This is especially important for big objects and TypedArrays. | ||
@@ -112,0 +114,0 @@ (Dell Precision 5540, i7-9850H CPU @ 2.60GHz, Node.js 16.11.1) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
163
0
31797
9
601
1