lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
22 lines • 753 B
JavaScript
import { validateBox } from './validateBox.js';
/**
* A validator function which checks whether an input value is a
* {@link ValidatedBox}. Doesn't stop the validator chain.
*
* @category XML
*/
export function validateValidatedBox(value) {
// TODO it would be nice if param validators would assert input types
validateBox(value)[0];
if (!('valid' in value)) {
throw new Error('Invalid ValidatedBox; no "valid" field');
}
if (!('validValue' in value)) {
throw new Error('Invalid ValidatedBox; no "validValue" field');
}
if (!('validate' in value)) {
throw new Error('Invalid ValidatedBox; no "validate" method');
}
return [value, false];
}
//# sourceMappingURL=validateValidatedBox.js.map