Spaces:
Paused
Paused
Download node_modules/@plotly/mapbox-gl/src/style-spec/validate/validate_number.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 917 Bytes
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style-spec/validate/validate_number.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/mapbox-gl/src/style-spec/validate/validate_number.js
-
curl -L -o validate_number.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style-spec/validate/validate_number.js
917 Bytes
| import getType from '../util/get_type'; | |
| import ValidationError from '../error/validation_error'; | |
| export default function validateNumber(options) { | |
| const key = options.key; | |
| const value = options.value; | |
| const valueSpec = options.valueSpec; | |
| let type = getType(value); | |
| // eslint-disable-next-line no-self-compare | |
| if (type === 'number' && value !== value) { | |
| type = 'NaN'; | |
| } | |
| if (type !== 'number') { | |
| return [new ValidationError(key, value, `number expected, ${type} found`)]; | |
| } | |
| if ('minimum' in valueSpec && value < valueSpec.minimum) { | |
| return [new ValidationError(key, value, `${value} is less than the minimum value ${valueSpec.minimum}`)]; | |
| } | |
| if ('maximum' in valueSpec && value > valueSpec.maximum) { | |
| return [new ValidationError(key, value, `${value} is greater than the maximum value ${valueSpec.maximum}`)]; | |
| } | |
| return []; | |
| } | |