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) 438 B
import type { SymbolSetableCriteria } from "./types"; import type { FormatTemplate } from "../types"; export const SymbolFormat: FormatTemplate<SymbolSetableCriteria> = { defaultCriteria: {}, checking(queue, path, criteria, value) { if (typeof value !== "symbol") { return "TYPE_NOT_SYMBOL"; } else if (criteria.symbol !== undefined && criteria.symbol !== value) { return "VALUE_INVALID_SYMBOL"; } return (null); } }