package.src.style-spec.read_style.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapbox-gl Show documentation
Show all versions of mapbox-gl Show documentation
A WebGL interactive maps library
The newest version!
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;
}