UNPKG

@loopback/docs

Version:
35 lines (22 loc) 1.07 kB
--- lang: en title: 'API docs: context.transformvalueorpromise' keywords: LoopBack 4.0, LoopBack 4 sidebar: lb4_sidebar permalink: /doc/en/lb4/apidocs.context.transformvalueorpromise.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [transformValueOrPromise](./context.transformvalueorpromise.md) ## transformValueOrPromise() function Transform a value or promise with a function that produces a new value or promise <b>Signature:</b> ```typescript export declare function transformValueOrPromise<T, V>(valueOrPromise: ValueOrPromise<T>, transformer: (val: T) => ValueOrPromise<V>): ValueOrPromise<V>; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | valueOrPromise | <code>ValueOrPromise&lt;T&gt;</code> | The value or promise | | transformer | <code>(val: T) =&gt; ValueOrPromise&lt;V&gt;</code> | A function that maps the source value to a value or promise | <b>Returns:</b> `ValueOrPromise<V>`