string2js

0.2.0 • Public • Published

string2js

Create Javascript objects and primitives from their string representation

This module expose a function to convert string values to Javascript objects. It also offer a reviver() function to be used with JSON.parse().

RegExp

The module allow to reviver RegExp objects. To serialize them automatically as JSON, just add the next snippet to the begining of your code:

if(RegExp.prototype.toJSON === undefined)
   RegExp.prototype.toJSON = RegExp.prototype.toString

Package Sidebar

Install

npm i string2js

Weekly Downloads

7

Version

0.2.0

License

ISC

Unpacked Size

3.67 kB

Total Files

4

Last publish

Collaborators

  • piranna