Pankaj Patel
Pankaj Patel

Pankaj Patel

Today's npm package: javascript-stringify

Pankaj Patel's photo
Pankaj Patel
ยทJun 15, 2021ยท

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Today's npm package is javascript-stringify

You can use this package to convert JavaScript to string so that it can be evaluated later with eval

const { stringify } = require("javascript-stringify");

const square = (x) => Math.pow(x, 2);

const stringifiedSquare = stringify( square )

console.log(typeof stringifiedSquare, stringifiedSquare)

javascript-stringify

See it in action here: runkit.com/pankaj/javascript-stringify

Stay tuned for tomorrow's package of the Day.

ย 
Share this