Changed to constructor functions
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import { Validator, Args } from "../mod.ts";
|
||||
|
||||
export const isBoolean: Validator = {
|
||||
type: "isBoolean",
|
||||
check: (value: any) => {
|
||||
if (value === null || value === undefined) return;
|
||||
if (value !== true && value !== false) {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
message: (value: any, args?: Args) => {
|
||||
return `This value has to be a boolean.`;
|
||||
},
|
||||
};
|
||||
export function isBoolean(): Validator {
|
||||
return {
|
||||
type: "isBoolean",
|
||||
check: (value: any) => {
|
||||
if (value === null || value === undefined) return;
|
||||
if (value !== true && value !== false) {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
message: (value: any, args?: Args) => {
|
||||
return `This value has to be a boolean.`;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user