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

@solana/fast-stable-stringify

Package Overview
Dependencies
Maintainers
15
Versions
691
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/fast-stable-stringify

Deterministic stringification for when performance and bundle size matters

  • 2.0.0-preview.2.20240417193928.028bdcca60ca69897ea2131e4047c607ec354a3e
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.2K
increased by17.29%
Maintainers
15
Weekly downloads
 
Created
Source

fast-stable-stringify

This project is a fork of nickyout/fast-stable-stringify

The most popular repository providing this feature is substack's json-stable-stringify. The intent if this library is to provide a faster alternative for when performance is more important than features. It assumes you provide basic javascript values without circular references, and returns a non-indented string.

Usage:

import stringify from '@solana/fast-stable-stringify';
stringify({ d: 0, c: 1, a: 2, b: 3, e: 4 }); // '{"a":2,"b":3,"c":1,"d":0,"e":4}'

Just like substack's, it does:

  • handle all variations of all basic javascript values (number, string, boolean, array, object, null, Date, BigInt)
  • handle undefined and function in the same way as JSON.stringify
  • not support ie8 (and below) with complete certainty.

Unlike substack's, it does:

  • not implement the 'replacer' or 'space' arguments of the JSON.stringify method
  • not check for circular references

Running tests

npm run test:unit:browser
npm run test:unit:node

Keywords

FAQs

Package last updated on 17 Apr 2024

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