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

@fullstory/safe-stringify

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fullstory/safe-stringify

Fullstory safe stringify

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
Created
Source

Fullstory safe stringify

Safe stringify is a utility function that stringifies a variety of JavaScript data types and structures like Objects, Arrays, and Dates. It tries its best to mirror what console.log would print in the JS console.

Installation

with npm
npm i @fullstory/safe-stringify --save
with yarn
yarn add @fullstory/safe-stringify

Exports

safeStringify(o, maxChars)

Parameters
  • o | <any> The data to stringify.
  • maxChars | <number> The length of the stringified result before truncation. Defaults to 1024.
Usage

Returns a stringified version of the data passed.

Examples
{
  const arr = [1, 2, 3, [4, 5, [6, 7, 8], 9], 10];
  const resultArr = safeStringify(arr);
  // resultArr === "[1,2,3,[4,5,[6,7,8],9],10]"

  const obj = { a: 1, b: 2, c: null, d: undefined, e: 'asdf' };
  const resultObj = safeStringify(obj);
  // resultObj === '{"a":1,"b":2,"c":null,"d":"undefined","e":"asdf"}'
}

FAQs

Package last updated on 01 May 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