UNPKG

valia

Version:

A runtime data validator in TypeScript with advanced type inference, built-in validation functions, and seamless integration for server and client environments.

17 lines (14 loc) 402 B
import type { SymbolSetableCriteria } from "./types"; import type { Format } from "../types"; export const SymbolFormat: Format<SymbolSetableCriteria> = { type: "symbol", check(chunk, criteria, value) { if (typeof value !== "symbol") { return "TYPE.SYMBOL.NOT_SATISFIED"; } else if (criteria.symbol && value !== criteria.symbol) { return "SYMBOL.NOT_ALLOWED"; } return (null); } }