This commit is contained in:
14
node_modules/@mapbox/mapbox-gl-style-spec/read_style.js
generated
vendored
Normal file
14
node_modules/@mapbox/mapbox-gl-style-spec/read_style.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import ParsingError from './error/parsing_error.js';
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user