4 ms·
> Whereas javascript you can just go `require(myjsonfile)` I'm not current on Node features, but that looks dangerous to do. Is that equivalent to reading the
by cpburns2009 8y ago
> Whereas javascript you can just go `require(myjsonfile)`
I'm not current on Node features, but that looks dangerous to do. Is that equivalent to reading the file and `eval()`ing it?
- kbp 8y ago> I'm not current on Node features, but that looks dangerous to do. Is that equivalent to reading the file and `eval()`ing it? No: > const fs = require('fs') undefined > fs.writeFileSync('file.js', 'console.log("yes")'); require('./file') yes {} > fs.writeFileSync('file.json', 'console.log("no")'); require('./file.json') SyntaxError: file.json: Unexpected token c in JSON at position 0
- gaius 8y agoThis is the community that installs things by curl|sudo bash, remember