transform()
Transforms the value using the provided callback function.
transform<R>(fn: (value: T) => R): Builder<R>;
Notes
- Applied after all checks and transformations added so far.
- Additional checks and transformations can be chained after this call.
Parameters
- fn — The transformation function.
Return value
This builder, for chaining; typed using the return type of the transformation function.
Examples
f.string().transform(s => s.trim()).check(s => s.length > 0);
f.number().transform(n => n * 100).positive();
Related
class Builder static
A class that represents a validation builder for an input value.
