iterator-to-array

Stupid iterator -> array function


Keywords
iterator, array
License
MIT
Install
npm install iterator-to-array@1.0.0

Documentation

iterator-to-array

NPM version Build status Test coverage Dependency Status License Downloads

Stupid iterator -> array function until io.js supports Array.from or the polyfill supports the iterator. Or rest parameters or generator comprehensions are supported. Hate this.

API

let arr = toArray(iterable)

Example:

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

const map = new Map()
map.set(1, 100)
map.set(2, 200)

assert.deepEqual([1, 2], toArray(map.keys()))