maplibre-gl
Version:
BSD licensed community fork of mapbox-gl, a WebGL interactive maps library
15 lines (12 loc) • 408 B
JavaScript
import ParsingError from './error/parsing_error';
import jsonlint from '@mapbox/jsonlint-lines-primitives';
export default function readStyle(style) {
if (style instanceof String || typeof style === 'string' || style instanceof Buffer) {
try {
return jsonlint.parse(style.toString());
} catch (e) {
throw new ParsingError(e);
}
}
return style;
}