allowed null and undefined

This commit is contained in:
Sebastian Seedorf
2020-05-26 09:56:57 +02:00
parent 05427eb47b
commit 7367af7fe4
4 changed files with 9 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ import { Validator, Args } from "../mod.ts";
export const isString: Validator = {
type: "isString",
check: (value: any) => {
if (value === null || value === undefined) return;
if (typeof value !== "string" && !(value instanceof String)) {
return {};
}