Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 793 Bytes

README.md

File metadata and controls

18 lines (13 loc) · 793 Bytes

@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"]]