Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

safe-stable-stringify

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

16

CHANGELOG.md
# 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 @@

4

index.js

@@ -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)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc