Files
deno-valideno/validators/string.ts
Sebastian Seedorf 218e596ede deno fmt
2020-05-26 00:20:44 +02:00

14 lines
350 B
TypeScript

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