Files
deno-valideno/validators/array.ts
Sebastian Seedorf 9fa06685ba more validators
2020-05-26 16:52:26 +02:00

15 lines
339 B
TypeScript

import { Validator, Args } from "../mod.ts";
export const isArray: Validator = {
type: "isArray",
check: (value: any) => {
if (value === null || value === undefined) return;
if (!Array.isArray(value)) {
return {};
}
},
message: (value: any, args?: Args) => {
return `This value has to be an array.`;
},
};