Files
deno-valideno/validators/symbol.ts
2020-05-26 19:40:41 +02:00

17 lines
383 B
TypeScript

import { Validator, Args } from "../mod.ts";
export function isSymbol(): Validator {
return {
type: "isSymbol",
check: (value: any) => {
if (value === null || value === undefined) return;
if (typeof value !== "symbol") {
return {};
}
},
message: (value: any, args?: Args) => {
return `This value has to be a symbol.`;
},
};
}