@frauschert/ts-guard
Version:
ts-guard is a typescript library that provides composable type guards. Its inspired by zod but focusses only on type guards and is more lightweight.
15 lines • 422 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isTuple = isTuple;
function isTuple(guards) {
return (value) => {
if (!Array.isArray(value)) {
return false;
}
if (value.length !== guards.length) {
return false;
}
return guards.every((guard, index) => guard(value[index]));
};
}
//# sourceMappingURL=isTuple.js.map