UNPKG

ottoman

Version:
29 lines 963 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSchemaFactoryType = exports.isSchemaTypeSupported = exports.is = void 0; const schema_1 = require("../schema"); /** * Checking if a value is a specific type or constructor * @param val * @param type */ const is = (val, type) => ![, null].includes(val) && (val.name === type.name || val.constructor.name === type.name); exports.is = is; /** * Checking if a value is a type supported by Ottoman. * @param val */ const isSchemaTypeSupported = (val) => { return val.constructor['sName'] in schema_1.Schema.Types; }; exports.isSchemaTypeSupported = isSchemaTypeSupported; /** * Checking if a value is a factory supported by Ottoman. * @param value * @param factory List of Schema Factories */ const isSchemaFactoryType = (value, factory) => { return value.name in factory; }; exports.isSchemaFactoryType = isSchemaFactoryType; //# sourceMappingURL=is-type.js.map