jprichardson / node-jsonfile

Easily read/write JSON files.
MIT License
1.2k stars 321 forks source link

replace \n with EOL #87

Closed kellyselden closed 7 years ago

kellyselden commented 7 years ago

Would you be open to supporting native OS newlines? This would mean less newline processing in my tests because my fixture files in git have OS newlines already. Right now I'm doing something like

fs.writeFileSync(filePath, JSON.stringify(value, null, 2).replace(/\n/g, EOL) + EOL));

to work cross-platform, but it would be great to just use this lib.

jprichardson commented 7 years ago

Yes, PR accepted, please include a test.