d2l-intl
Version:
D2L internationalization APIs for number, date and time formatting and parsing.
13 lines (12 loc) • 300 B
JavaScript
export default function validateFormatValue(value) {
if (value === undefined || value === null) {
return 0;
}
if (typeof value === 'string') {
value = parseFloat(value);
}
if (isNaN(value) || typeof value !== 'number') {
throw new RangeError('value is out of range.');
}
return value;
}