valia
Version:
A runtime data validator in TypeScript with advanced type inference, built-in validation functions, and seamless integration for server and client environments.
14 lines (11 loc) • 316 B
text/typescript
import type { BooleanSetableCriteria } from "./types";
import type { Format } from "../types";
export const BooleanFormat: Format<BooleanSetableCriteria> = {
type: "boolean",
check(chunk, criteria, value) {
if (typeof value !== "boolean") {
return ("TYPE.BOOLEAN.NOT_SATISFIED");
}
return (null);
},
}