Windshaft-cartodb/lib/cartodb/utils/json-replacer.js
Daniel García Aubert a21d7db390 Extract json-replacer
2018-04-03 13:21:41 +02:00

20 lines
477 B
JavaScript

module.exports = function jsonReplacerFactory () {
// Fix: https://github.com/CartoDB/Windshaft-cartodb/issues/705
// See: http://expressjs.com/en/4x/api.html#app.set
return function jsonReplacer (key, value) {
if (value !== value) {
return 'NaN';
}
if (value === Infinity) {
return 'Infinity';
}
if (value === -Infinity) {
return '-Infinity';
}
return value;
};
};