compose
compose :: [ Function ] → a → Boolean
It's the very backbone of Deep Waters, it takes a list of validators
(functions that accept a value and return a boolean) and returns a new function that takes a value
and evaluates whether
is valid for all the validators in
.
isEmail.js
import compose from './compose';
import isString from './isString';
import matchesPattern from './matchesPattern';
const isEmail = compose(
isString,
matchesPattern(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/),
);
export default isEmail;
Please note, compose removes all the duplicate validators
Last modified 2yr ago