async-iterator-first

Returns the first result from an async iterator

Please use it-first instead, it's a drop-in replacement for this module
Last updated 7 years ago by achingbrain .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install async-iterator-first 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (7 years ago)

3 Versions

  • 1.0.0 [deprecated]           ...           7 years ago
  • 0.0.2 [deprecated]           ...           7 years ago
  • 0.0.1 [deprecated]           ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |