4.0.1 • Published 7 years ago

starry.async-race v4.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

npm node

Status

Applies to the whole suite.

Build Status Coverage Status

Usage

function asyncRace<T = any, U = any>(
  iterable: Iterable<T>, 
  asyncAction: (item: T) => PromiseLike<U>
  )

Returns a promise that resolves with the first, of the return values of asyncAction called upon each element of iterable, which resolved.

Parameters:

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

Returns: Promise<U>

A handy shortcut for:

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

But with iterable support. ☺

4.0.1

7 years ago

3.0.0

8 years ago

3.0.0-1

8 years ago

3.0.0-0

8 years ago

2.0.0

8 years ago

2.0.0-0

8 years ago

1.6.1

8 years ago

1.4.1

8 years ago

1.3.0

8 years ago

1.1.1

8 years ago

1.0.0

9 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.0.1

9 years ago