---
lang: en
title: 'API docs: context.resolvemap'
keywords: LoopBack 4.0, LoopBack 4
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, map: MapObject<T>) => ValueOrPromise<V>): ValueOrPromise<MapObject<V>>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  map | <code>MapObject&lt;T&gt;</code> | The original object containing the source entries |
|  resolver | <code>(val: T, key: string, map: MapObject&lt;T&gt;) =&gt; ValueOrPromise&lt;V&gt;</code> | 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<MapObject<V>>`

## 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'}`<!-- -->.


