You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to delete an object property via the delete keyword:
When I do that with hjson, the property is set to undefined.
See example
constpath=require('path')constpromisify=require('promisify-node')constfs=promisify('fs')consthjson=require('hjson')constCONFIGFILE=path.resolve(__dirname,'../serverconfig.hjson')asyncfunctionget(){constfile=awaitfs.readFile(CONFIGFILE)returnhjson.rt.parse(file.toString())}asyncfunctionset(config){constjson=hjson.rt.stringify(config,{quotes: 'strings',space: 4,// can also use \t for tabsbracesSameLine: true,})awaitfs.writeFile(CONFIGFILE,json)}(async()=>{varx=awaitget()deletex.exampleawaitset(x)// hjson file still contains `example` property})()
The text was updated successfully, but these errors were encountered:
I don't have time to look at it now but I guess it's a bug with round-tripping the comments. If you don't need that feature you can use hjson.stringify().
I would like to be able to delete an object property via the
delete
keyword:When I do that with hjson, the property is set to
undefined
.See example
The text was updated successfully, but these errors were encountered: