import { defineValidator } from "https://deno.land/x/abstruct@1.0.0/mod.ts";
Create Validator from Validator.validate.
Examples
import { defineValidator } from "https://deno.land/x/abstruct@$VERSION/validators/utils.ts";
import { defineValidator } from "https://deno.land/x/abstruct@$VERSION/validators/utils.ts";
const StringValidator = defineValidator<unknown, string>(function* (input) {
const typeOf = typeof input;
if (typeOf !== "string") {
yield { message: should be string, actual ${typeOf}
, instancePath: [] };
}
});
Parameters
validate: (input: In) => Iterable<ValidationFailure>