Changed to constructor functions
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
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.`;
|
||||
},
|
||||
};
|
||||
export function isArray(): Validator {
|
||||
return {
|
||||
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.`;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user