obj-string

1.0.0 • Public • Published

obj-string

Convert objects to strings for code generation

Usage

See all valid object properties and limitations here

import { stringifyObject } from 'obj-string'

let str = stringifyObject({
  data: {
    list: [0,2,4,6,8],
    nested: {
      value: 4
    }
  },
  method(param){
    console.log(param)
  }
})

console.log(str)

/*
{
  "data":{
    "list":[0,2,4,6,8],
    "nested":{
      "value":4
    }
  },
  "method": function (param){
    console.log(param)
  }
}
*/

References

Code heavily inspired by stringified-handler


License

MIT © Marshall Brandt

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i obj-string

    Weekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    5.14 kB

    Total Files

    5

    Last publish

    Collaborators

    • marshallcb