Files
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00

15 lines
411 B
JavaScript

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;
}