Files
coopgo/node_modules/@mapbox/mapbox-gl-style-spec/validate/validate_glyphs_url.js
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

25 lines
732 B
JavaScript

// @flow
import ValidationError from '../error/validation_error.js';
import validateString from './validate_string.js';
import type {ValidationOptions} from './validate.js';
export default function(options: ValidationOptions): Array<ValidationError> {
const value = options.value;
const key = options.key;
const errors = validateString(options);
if (errors.length) return errors;
if (value.indexOf('{fontstack}') === -1) {
errors.push(new ValidationError(key, value, '"glyphs" url must include a "{fontstack}" token'));
}
if (value.indexOf('{range}') === -1) {
errors.push(new ValidationError(key, value, '"glyphs" url must include a "{range}" token'));
}
return errors;
}