Back to Explore

BridgeAR/safe-stable-stringify

GitHub
1 watchersOpen source

Last release:

safe-stable-stringify is a zero-dependency JavaScript serialization utility that provides a safe, deterministic, and fast alternative to JSON.stringify, including support for circular structures and BigInt without throwing (configurable). It offers the same stringify signature as JSON.stringify, plus configuration options such as deterministic key ordering and strict JSON compatibility checks.

Project status

  • Maintenance status: The project appears to have ongoing repository activity (last upstream push was 2026-02-05), but the most recent tagged updates you provided are from v2.5.0 in 2024-08-01, suggesting a slow, less frequent release/update rhythm rather than constant iteration.
  • Update cadence: Based on the available tags, updates have been infrequent (2022-12-28, 2023-03-19, 2024-08-01), so cadence is best described as sporadic and not aligned with frequent, regular releases.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v2.5.0

    v2.5.0 extends the `deterministic` option so it can take a comparator function, which is then used to deterministically sort object keys using `Array#sort(comparator)`. The release notes also mention a very minor performance optimization. The code changes go beyond that, including updates to escaping logic and some type handling around array and typed-array detection.

    Features
  • v2.4.3

    v2.4.3 focuses on correcting how array and TypedArray keys are passed to `toJSON` and the `replacer`, and on improving string escaping performance. The release notes describe specific behavioral fixes for key typing and TypedArray handling, plus a performance optimization for escaping long strings.

    Breaking
  • v2.4.2

    v2.4.2 focuses on TypeScript type refinements for ESM usage and improves typing for the stringify replacer. The code diff, however, also includes an actual runtime behavior change that is not mentioned in the release notes.

  • v2.4.1

    v2.4.1 focuses on updating TypeScript typings for safe-stable-stringify, specifically making the stringify return type more accurate based on the input. The code diff also includes a small runtime behavior change around how option objects are accessed, plus a restructuring of the exported type declarations.

    Breaking
  • v2.4.0

    v2.4.0 introduces a new `strict` option to enforce JSON compatibility by throwing when values cannot be represented safely. It also updates TypeScript typings to better support ESM code bases.

    BreakingFeatures
  • v2.3.1

    v2.3.1 updates safe-stable-stringify’s string escaping regex to avoid an “invalid regexp group” failure in environments that do not support negative lookbehind. The code also changes how escape replacements are computed for certain regex matches, which may affect edge-case Unicode surrogate handling.

  • v2.3.0

    v2.3.0 extends `circularValue` support so callers can pass an `Error` (or `TypeError`) constructor to force circular-reference handling to throw, matching the behavior of native `JSON.stringify`. It also corrects Unicode surrogate escaping so only lone surrogates are escaped, while valid surrogate pairs are preserved.

    Features
  • v2.2.0

    v2.2.0 mainly adds support for configuring circular references with `circularValue: undefined`, causing circular properties to be skipped during serialization. It also reduces the published package size by excluding test/benchmark artifacts and other non-essential files via npm ignore rules.

    Features
  • v2.1.0

    v2.1.0 adds two new limiting options, maximumBreadth and maximumDepth, and claims compliance with the well formed stringify proposal. The implementation also includes multiple escaping and stringification logic changes, plus fixes for spacer length, TypeScript types, and duplicate array replacer handling.

    Features
  • v2.0.0

    v2.0.0 is a major rewrite of safe-stable-stringify that adds configurable behavior around BigInt handling, circular value rendering, and deterministic key ordering. It also introduces ESM support and targets performance improvements such as faster TypedArray stringification and a smaller codebase by removing the previous stable.js implementation.

    BreakingFeatures