stringify-full

1.0.0 • Public • Published

stringify-full

a tool which can stringify the Function and RegExp in the js object

.eg

var o = {
  name: 'stringify-full',
  method: function() {
    console.log('this is a function');
  },
  reg: /\w+/
}

Now, I want to convert the object o into string, if we use JSON.stringify, it will lost the property method and reg

{"name":"demo","reg":{}}

This is not what we want. Now we can use the tool stringify-full

const stringify = require('stringify-full');
console.log(stringify(o));

output:

{"name":"demo","method":function() {
    console.log('this is a function');
  },"reg":/\w+/

Readme

Keywords

none

Package Sidebar

Install

npm i stringify-full

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

2.23 kB

Total Files

3

Last publish

Collaborators

  • bonjs