This package has been deprecated

Author message:

Please use it-first instead, it's a drop-in replacement for this module

async-iterator-first

1.0.0 • Public • Published

async-iterator-first

Build status Coverage Status Dependencies Status

Returns the first result from an async iterator

Mostly useful for tests.

Install

$ npm install --save async-iterator-first

Usage

const first = require('async-iterator-first')
 
async function * iterator (values) {
  for (let i = 0; i < values.length; i++) {
    yield values[i]
  }
}
 
const res = await first(iterator([0, 1, 2, 3, 4]))
 
console.info(res) // 0

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published

Package Sidebar

Install

npm i async-iterator-first

Weekly Downloads

79

Version

1.0.0

License

ISC

Unpacked Size

2.3 kB

Total Files

5

Last publish

Collaborators

  • achingbrain