UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

36 lines (23 loc) 1.27 kB
--- lang: en title: 'API docs: context.transformvalueorpromise' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context 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 | [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;T&gt; | The value or promise | | transformer | (val: T) =&gt; [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;V&gt; | A function that maps the source value to a value or promise | <b>Returns:</b> [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;V&gt;