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