docschema
Version:
Schema declaration and validation library using JsDoc comments
47 lines (46 loc) • 1.51 kB
TypeScript
/**
* A checker function should:
* - Return true when the value matches the type.
* - Return false when the type name doesn't match, basically
* skip the check.
* - Return false when the value doesn't match the type.
*
* @type {{
* simple: {
* 'any' : CheckerFunctionSimple,
* 'boolean' : CheckerFunctionSimple,
* 'number' : CheckerFunctionSimple,
* 'string' : CheckerFunctionSimple,
* 'null' : CheckerFunctionSimple,
* 'undefined' : CheckerFunctionSimple,
* 'bigint' : CheckerFunctionSimple,
* 'symbol' : CheckerFunctionSimple,
* },
* complex: {
* 'array' : CheckerFunctionComplex,
* 'object' : CheckerFunctionComplex,
* 'objectLiteral' : CheckerFunctionComplex,
* 'typedef' : CheckerFunctionComplex,
* 'directImport' : CheckerFunctionComplex,
* }
* }}
*/
export const checkers: {
simple: {
"any": CheckerFunctionSimple;
"boolean": CheckerFunctionSimple;
"number": CheckerFunctionSimple;
"string": CheckerFunctionSimple;
"null": CheckerFunctionSimple;
"undefined": CheckerFunctionSimple;
"bigint": CheckerFunctionSimple;
"symbol": CheckerFunctionSimple;
};
complex: {
"array": CheckerFunctionComplex;
"object": CheckerFunctionComplex;
"objectLiteral": CheckerFunctionComplex;
"typedef": CheckerFunctionComplex;
"directImport": CheckerFunctionComplex;
};
};