starry.async-all

4.0.1 • Public • Published

Member of the starry suite—modular functions for iterable objects.

npm node

Status

Applies to the whole suite.

Build Status Coverage Status

Usage

function asyncAll<T = any, U = any>(
  iterable: Iterable<T>, 
  asyncAction: (item: T) => PromiseLike<U>
  ): Promise<U[]>

Returns a promise that resolves with an array representing the resolved values of the return value of asyncAction called upon each element of iterable.

Parameters:

  • iterable: Iterable<T> - An iterable collection
  • asyncAction: (item: T) => PromiseLike<U> - A thenable called with each item

Returns: Promise<U[]>

A handy shortcut for:

Promise.all([].map(async function() { ... }))

But with iterable support.

Package Sidebar

Install

npm i starry.async-all

Weekly Downloads

1

Version

4.0.1

License

MIT

Unpacked Size

3.54 kB

Total Files

9

Last publish

Collaborators

  • seangenabe