lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
16 lines • 471 B
JavaScript
/**
* A validator function which checks whether an input value is a number
* (including a NaN check). Doesn't stop the validator chain.
*
* @category XML
*/
export function validateNumber(value) {
if (typeof value !== 'number') {
throw new Error('Invalid number; not a number type');
}
if (isNaN(value)) {
throw new Error('Invalid number; not a number (NaN)');
}
return [value, false];
}
//# sourceMappingURL=validateNumber.js.map