mapOrForUndefinable
Return the result of transformer with using input as an argument for it if input is not undefined
.
Otherwise, return defaultValue.
Basically, this operation is a combination map()
and unwrapOr()
.
U
must not beUndefinable<*>
.- If the result of transformer is
undefined
, this throw anError
. - If the result of defaultValue is
undefined
, this throw anError
.
- If the result of transformer is
- If you'd like to accept
Undefinable<*>
asU
, use a combinationandThen()
andor()
.
function mapOrForUndefinable<T, U>(
input: Undefinable<T>,
defaultValue: NotUndefined<U>,
transformer: TransformFn<T, NotUndefined<U>>,
): NotUndefined<U>;§
mapOrForUndefinable<T, U>(input: Undefinable<T>, defaultValue: NotUndefined<U>, transformer: TransformFn<T, NotUndefined<U>>): NotUndefined<U>
[src]§Parameters
§
input: Undefinable<T>
[src]§
defaultValue: NotUndefined<U>
[src]§
transformer: TransformFn<T, NotUndefined<U>>
[src]