2.0.3 • Published 1 month ago

@irrelon/promise-map v2.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
1 month ago

Irrelon PromiseMap

This micro-helper allows you to do a Promise.all() except instead of passing an array of promises that you then extract via array indices you can pass an object of key / values with each value being a promise and then extract resolved values by key name instead:

const result = await promiseMap({
    foo: fetch("https://www.google.com"),
    bar: someOtherPromise
});

// result.foo is now the fetch response
// result.bar is the response from your other theoretical promise

Install

npm i @irrelon/promise-map

Usage

TypeScript and ES6 Modules

import {promiseMap} from "@irrelon/promise-map";

CommonJS

const {promiseMap} = require("@irrelon/promise-map").default;
2.0.3

1 month ago

2.0.2

1 month ago

2.0.1

1 month ago

2.0.0

1 month ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago