Skip to content

fromIterator

Subhajit Sahu edited this page Jun 15, 2020 · 4 revisions

Converts iterator to iterable. 🏃 📼 📦 🌔 📒

Alternatives: from, fromRange, fromApply.
Similar: isIterator, iterator, from.

iterable.from(x);
// x: an iterable/iterator
const iterable = require('extra-iterable');

var x = [1, 2].values();
var xi = x[Symbol.iterator]();
[...iterable.from(xi)];
// [ 1, 2 ]

references

Clone this wiki locally