piral-cli
Version:
The standard CLI for creating and building a Piral instance or a Pilet.
13 lines • 644 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ensure = ensure;
const log_1 = require("./log");
function ensure(name, value, expectedType) {
const actualType = typeof value;
const expectedTypes = Array.isArray(expectedType) ? expectedType : [expectedType];
if (!expectedTypes.includes(actualType)) {
const type = expectedTypes.length === 1 ? `"${expectedTypes[0]}"` : `one of "${expectedTypes.join('", "')}"`;
(0, log_1.fail)('generalError_0002', `The type for "${name}" is invalid - it should be ${type}, but was "${actualType}".`);
}
}
//# sourceMappingURL=validate.js.map