runtyp
Version:
Lightning-fast, zero-dependency runtime validation for TS/JS. 25x faster than zod with a cleaner API.
19 lines • 477 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.custom = void 0;
function custom(predicate, errorMessage) {
return (value) => {
if (!predicate(value)) {
return {
isValid: false,
errors: { root: errorMessage },
};
}
return {
isValid: true,
value: value,
};
};
}
exports.custom = custom;
//# sourceMappingURL=custom.js.map