Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

faster-stable-stringify

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faster-stable-stringify

Faster deterministic JSON.stringify() without bells and whistles.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

faster-stable-stringify

Faster deterministic JSON.stringify() without bells and whistles.

const stableStringify = require('faster-stable-stringify');

const json = stableStringify({greetings: 'Hello!', apples: 'bananas'});
// json = {"apples":"bananas","greetings":"Hello!"}

Installation

$ npm install faster-stable-stringify

Features

  • JSON.stringify that has deterministic output
  • Handles edge cases in accordance with the spec
  • Replaces cycles with "[Circular]" similar to isaac's json-stringify-safe

API

A single function is exported.

stableStringify(value)

The behavior is identical to the native JSON.stringify, excluding circular structures. See here for an explanation of the JSON.stringify behavior.

Alternatives

If you need to customize the sorting behavior, or want an implementation that throws on circular references, you may prefer to use substack's json-stable-stringify.

If you need it to work in the browser or in an environment without a native JSON.stringify, you may prefer to use nickyout's fast-stable-stringify.

Keywords

FAQs

Package last updated on 31 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc