map<O> method

ValidatorT<S, O> map<O>(
  1. Function1<T, O> transform
)

Transforms the ouput of the validator by running the provided function. Leaving the validation logic untouched. returns validator with coerced output.

Implementation

ValidatorT<S, O> map<O>(Function1<T, O> transform) {
  return (S input) {
    final eitherErrorOrResult = this(input);
    return eitherErrorOrResult.map((value) {
      return transform(value);
    });
  };
}