mapOrAsyncForUndefinable
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 mapOrAsyncForUndefinable<T, U>(
input: Undefinable<T>,
defaultValue: NotUndefined<U>,
transformer: AsyncTransformFn<T, NotUndefined<U>>,
): Promise<NotUndefined<U>>;§
mapOrAsyncForUndefinable<T, U>(input: Undefinable<T>, defaultValue: NotUndefined<U>, transformer: AsyncTransformFn<T, NotUndefined<U>>): Promise<NotUndefined<U>>
[src]§Parameters
§
input: Undefinable<T>
[src]§
defaultValue: NotUndefined<U>
[src]§
transformer: AsyncTransformFn<T, NotUndefined<U>>
[src]§Return Type
§
Promise<NotUndefined<U>>
[src]