unless
Returns a function that applies a transform only when a predicate fails, otherwise returns the value unchanged.
Complement of when.
Usage
unless<T>(predicate: (value: T) => boolean, fn: (value: T) => T)
Returns a function that applies a transform only when a predicate fails, otherwise returns the value unchanged.
Complement of when.
Parameters
predicate(value: T) => booleanrequired
the condition used to select behavior.
fn(value: T) => Trequired
the transformation to apply when predicate returns false.
Returns
a function that transforms values only when predicate returns false.