npm.io
0.1.0 • Published 8 years ago

@express-love/map-values-async

Licence
ISC
Version
0.1.0
Deps
0
Size
2 kB
Vulns
0
Weekly
0

Installation

npm install @express-love/map-values-async

Usage

mapValuesAsync

Creates a shallow clone of the specified source object. Any properties of the source object that are promises will be replaced with the resolved value.

Parameters

  • source Object An object with properties that might be promises
Examples
const result = await mapValuesAsync({
  a: Promise.resolve('apples'),
  b: Promise.resolve('bananas'),
  c: 'corn',
});

expect(result).toEqual({
  a: 'apples',
  b: 'bananas',
  c: 'corn',
});

Returns Object A clone of source with the promise properties replaced with their