form-validators
A collection of javascript form validators
isEmail
import { isEmail } from "form-validators";
const emailValidator = isEmail();
emailValidator("email@domain.com");
emailValidator("not an email address");
const customEmailValidator = isEmail("You dun goofed!");
customEmailValidator("email@domain.com");
customEmailValidator("not an email address");
const dynamicCustomEmailValidator = isEmail(
({ value }) => `Hmm... I don't think '${value}' is a valid email address.`
);
dynamicCustomEmailValidator("email@domain.com");
dynamicCustomEmailValidator("not an email address");