npm.io
3.1.4 • Published 6 years ago

@unction/fromiteratortoarray

Licence
ISC
Version
3.1.4
Deps
0
Size
20 kB
Vulns
0
Weekly
0

@unction/fromIteratorToArray

Tests Stability Dependencies

Map<A, B> => Array<[A, B]>

Takes an Iterator (SetIterator, MapIterator, etc) and turns it into an array.

fromIteratorToArray(new Set([1, 2, 3]).entries()) // [[1, 1], [2, 2], [3, 3]]
fromIteratorToArray(new Map([["aaa", "a"], ["bbb", "b"], ["ccc", "c"]]).entries()) // [["aaa", "a"], ["bbb", "b"], ["ccc", "c"]]