that<S> static method

Validator<S> that<S>(
  1. Predicate<S> predicate, {
  2. required dynamic error,
})

Creates a validator from predicate

Implementation

static Validator<S> that<S>(Predicate<S> predicate,
    {required dynamic error}) {
  return (s) => predicate(s) ? Right(s) : Left([error]);
}