JSPM

async-iterator-to-array

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1079
  • Score
    100M100P100Q16073F
  • License ISC

Collects all values from an async iterator and returns them as an array

Package Exports

  • async-iterator-to-array

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (async-iterator-to-array) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

async-iterator-to-array

Build status Coverage Status Dependencies Status

Collects all values from an async iterator and returns them as an array

Mostly useful for tests.

Install

$ npm install --save async-iterator-to-array

Usage

const toArray = require('async-iterator-to-array')

async function * iterator (values) {
  for (let i = 0; i < values.length; i++) {
    yield values[i]
  }
}

const arr = await toArray(iterator([0, 1, 2, 3, 4]))

console.info(arr) // 0, 1, 2, 3, 4