safe-stable-stringify

Safe, deterministic and fast serialization alternative to JSON.stringify.

MIT License

Downloads
61.6M
Stars
186
Committers
11
safe-stable-stringify - v2.4.3 Latest Release

Published by BridgeAR over 1 year ago

  • Fixed toJSON function receiving array keys as number instead of string
  • Fixed replacer function receiving array keys as number instead of string
  • Fixed replacer function not being called for TypedArray entries
  • Improved performance to escape long strings that contain characters that need escaping
safe-stable-stringify - v2.4.2

Published by BridgeAR almost 2 years ago

  • Improved ESM TypeScript types.
  • More precise TypeScript replacer type.
safe-stable-stringify - v2.4.1

Published by BridgeAR about 2 years ago

  • More precise TypeScript types. The return type is now either string, undefined or string | undefined depending on the input.
safe-stable-stringify - v2.4.0

Published by BridgeAR about 2 years ago

  • Added strict option to verify that the passed in objects are fully compatible with JSON without removing information. If not, an error is thrown.
  • Fixed TypeScript definition for ESM code bases
safe-stable-stringify - v2.3.1

Published by BridgeAR almost 3 years ago

  • Fix invalid regexp group error in browsers or environments that do not support the negative lookbehind regular expression assertion.
safe-stable-stringify - v2.3.0

Published by BridgeAR almost 3 years ago

  • Accept the Error constructor as circularValue option to throw on circular references as the regular JSON.stringify would:
import { configure } from 'safe-stable-stringify'

const object = {}
object.circular = object;

const stringify = configure({ circularValue: TypeError })

stringify(object)
// TypeError: Converting circular structure to JSON
  • Fixed escaping wrong surrogates. Only lone surrogates are now escaped.
safe-stable-stringify - v2.2.0

Published by BridgeAR almost 3 years ago

  • 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:
import { configure } from 'safe-stable-stringify'

const object = { array: [] }
object.circular = object;
object.array.push(object)

configure({ circularValue: undefined })(object)
// '{"array":[null]}'
safe-stable-stringify - v2.1.0

Published by BridgeAR about 3 years ago

  • Added maximumBreadth option to limit stringification at a specific object or array "width" (number of properties / values)
  • Added maximumDepth option to limit stringification at a specific nesting depth
  • Implemented the well formed stringify proposal that is now part of the spec
  • Fixed maximum spacer length (10)
  • Fixed TypeScript definition
  • Fixed duplicated array replacer values serialized more than once
safe-stable-stringify - v2.0.0

Published by BridgeAR about 3 years ago

  • [BREAKING] Convert BigInt to number by default instead of ignoring these values
    If you wish to ignore these values similar to earlier versions, just use the new bigint option and set it to false.
  • [BREAKING] Support ESM
  • [BREAKING] Requires ES6
  • Optional BigInt support
  • Deterministic behavior is now optional
  • The value to indicate a circular structure is now adjustable
  • Significantly faster TypedArray stringification
  • Smaller Codebase
  • Removed stateful indentation to guarantee side-effect freeness
safe-stable-stringify - v1.1.0

Published by BridgeAR about 6 years ago

  • Add support for IE11 (917b6128de135a950ec178d66d86b4d772c7656d)
  • Fix issue with undefined values (4196f87f16e95c711d1776102d6cc73f1c384431, 4eab558c2ddbf24adb5776e4fc1091aa8673b703)
  • Fix typescript definition (7a874787572eb373f6ce8d9c547ddc53165c832e)
  • Improve code coverage (ed8cadc4ec34eaa23ce268df7a044e38a61389e9, b58c494e1f70bdac4698fc56d0ad9d06f12b6e1e)
  • Update dev dependencies (b857ea8f75fc718a389ad816eb084978a905c2f6)
  • Improve docs