This commit is contained in:
Sebastian Seedorf
2020-05-26 00:20:44 +02:00
parent cd6ed23d47
commit 218e596ede
5 changed files with 72 additions and 39 deletions

View File

@@ -3,11 +3,11 @@ import { Validator, Args } from "../mod.ts";
export const isString: Validator = {
type: "isString",
check: (value: any) => {
if (typeof value !== 'string' && !(value instanceof String)) {
if (typeof value !== "string" && !(value instanceof String)) {
return {};
}
},
message: (value: any, args?: Args) => {
return `The value '${value && value.toString()}' has to be a string.`
}
}
return `The value '${value && value.toString()}' has to be a string.`;
},
};