UNPKG

@techntools/sequelize-to-openapi

Version:
22 lines 944 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkTypeRequired = checkTypeRequired; exports.checkTypeOptional = checkTypeOptional; function checkType(name, value, type, errorPrefix) { if (type === 'array' && !Array.isArray(value)) throw new TypeError(`${errorPrefix} configuration setting '${name}' not of type '${type}'`); if (type != 'array' && typeof value !== type) throw new TypeError(`${errorPrefix} configuration setting '${name}' not of type '${type}'`); return true; } function checkTypeRequired(name, value, type) { if (value === null) throw new TypeError(`Required configuration setting '${name}' is missing`); return checkType(name, value, type, 'Required'); } function checkTypeOptional(name, value, type) { if (value === null) return true; return checkType(name, value, type, 'Optional'); } //# sourceMappingURL=type-checks.js.map