---
lang: en
title: 'API docs: context.resolvemap'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.resolvemap.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [resolveMap](./context.resolvemap.md)

## resolveMap() function

Resolve entries of an object into a new object with the same keys. If one or more entries of the source object are resolved to a promise by the `resolver` function, this method returns a promise which will be resolved to the new object with fully resolved entries.

<b>Signature:</b>

```typescript
export declare function resolveMap<T, V>(map: MapObject<T>, resolver: (val: T, key: string, values: MapObject<T>) => ValueOrPromise<V>): ValueOrPromise<MapObject<V>>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  map | [MapObject](./context.mapobject.md)<!-- -->&lt;T&gt; | The original object containing the source entries |
|  resolver | (val: T, key: string, values: [MapObject](./context.mapobject.md)<!-- -->&lt;T&gt;) =&gt; [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;V&gt; | A function resolves an entry to a value or promise. It will be invoked with the property value, the property name, and the source object. |

<b>Returns:</b>

[ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;[MapObject](./context.mapobject.md)<!-- -->&lt;V&gt;&gt;

## Example

- Example 1: resolve all entries synchronously

```ts
const result = resolveMap({a: 'x', b: 'y'}, v => v.toUpperCase());

```
The `result` will be `{a: 'X', b: 'Y'}`<!-- -->.

- Example 2: resolve one or more entries asynchronously

```ts
const result = resolveMap({a: 'x', b: 'y'}, v =>
  Promise.resolve(v.toUpperCase()),
);

```
The `result` will be a promise of `{a: 'X', b: 'Y'}`<!-- -->.


