4 ms·
This is bike-shed, but `stringify`? What's wrong with `serialize` or `toJSON` or `toString'?
by polemic 15y ago
This is bike-shed, but `stringify`? What's wrong with `serialize` or `toJSON` or `toString'?
- shantanubala 15y agoThis is mainly for consistency with the previous JSON libraries developed by Douglas Crockford. In JavaScript, it's easy enough to "create your own API" by just aliasing JSON.stringify to JSON.serialize or even a local "serialize" function that it isn't too much of an issue. As much as I agree that the naming convention isn't great, it's better to have consistency -- especially in a language as dynamic as JavaScript.
- jdd 15y ago@polemic @shantanubala `stringify` and `parse` are the names specified by the ECMAScript language spec: http://es5.github.com/#x15.12.3 http://es5.github.com/#x15.12.3
- polemic 15y agoAh, ok. Thanks!