Page Contents

Home > @loopback/context > transformValueOrPromise

transformValueOrPromise() function

Transform a value or promise with a function that produces a new value or promise

Signature:

export declare function transformValueOrPromise<T, V>(valueOrPromise: ValueOrPromise<T>, transformer: (val: T) => ValueOrPromise<V>): ValueOrPromise<V>;

Parameters

Parameter Type Description
valueOrPromise ValueOrPromise<T> The value or promise
transformer (val: T) => ValueOrPromise<V> A function that maps the source value to a value or promise

Returns:

ValueOrPromise<V>