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

node-stringify

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-stringify

Stringify all types of javascript objects.

  • 0.0.14
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-stringify Build Status

Stringify all types of javascript objects.

Install

npm install node-stringify --save

Example

var stringify = require('node-stringify');

console.assert(stringify(123) === '123');

console.assert(stringify('abc') === '\'abc\'');

console.assert(stringify(null) === 'null');

console.assert(stringify(undefined) === 'undefined');

console.assert(stringify(new Date(1000)) === 'new Date(1000)');

console.assert(stringify(function (a,b,c) {}) === '(function (a,b,c) {})');

console.assert(stringify([1, 2, 3]) === '[1,2,3]');

// The parenthesis is to make the result work with `eval`
console.assert(stringify({a: 1, b: 2}) === '({a:1,b:2})');

console.assert(stringify({a: 1, b: [2, 3]}) === '({a:1,b:[2,3]})');

Supported types

  • null
  • undefined
  • number
  • string
  • date
  • regexp
  • function
  • array
  • object

Difference with JSON.stringify

  • node-stringify is designed to work with all kinds of objects in javascript. JSON.stringify is designed to work with objects.

  • The result of node-stringify can be retrieved directly using eval.

License

MIT License

Keywords

FAQs

Package last updated on 30 Jun 2014

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