2 ms·
> you should be calling JSON.parse() not eval() The one major reason I could see to use "JSON" as a conf file is in trusted node.js apps because you can then
by furgooswft13 8y ago
> you should be calling JSON.parse() not eval()
The one major reason I could see to use "JSON" as a conf file is in trusted node.js apps because you can then easily embed functions and logic in them if you need more advanced/customizable configurations. And you can do it with full syntax highlighting in your editor. And comments, and trailing commas, and naked keys.
Of course this is no longer JSON, it's straight up Javascript config files. But it has come in handy a few times when I want to override standard behavior on a per config basis, and most of the file is still just plain key: val