maplibre-style-spec
maplibre-style-spec copied to clipboard
Factor out custom stringify function
Describe the bug
Same as https://github.com/maplibre/maplibre-gl-js/issues/967
In test/lib/utils.ts
we have a stringify and the following comment:
import compactStringify from 'json-stringify-pretty-compact';
// we have to handle this edge case here because we have test fixtures for this
// edge case, and we don't want UPDATE=1 to mess with them
export function stringify(v) {
let s = compactStringify(v);
if (s.indexOf('\u2028') >= 0) {
s = s.replace(/\u2028/g, '\\u2028');
}
if (s.indexOf('\u2029') >= 0) {
s = s.replace(/\u2029/g, '\\u2029');
}
return s;
}
maplibre-gl-js has removed all this function but maplibre-style-spec still available. If this implementation is needed, close this issue. Note: Also maplibre-style-spec uses stringifyPretty from json-stringify-pretty-compact.