Returns an iterable with the first limit items of iterable.
limit
iterable
function* naturalNumbers() { for(let i=0;; i++) { yield i; }}assert.deepEqual( toArray(Iterable.take(3, naturalNumbers())), [0, 1, 2]);assert.deepEqual( toArray(Iterable.take(2, ['a', 'b', 'c'])), ['a', 'b']); Copy
function* naturalNumbers() { for(let i=0;; i++) { yield i; }}assert.deepEqual( toArray(Iterable.take(3, naturalNumbers())), [0, 1, 2]);assert.deepEqual( toArray(Iterable.take(2, ['a', 'b', 'c'])), ['a', 'b']);
Returns an iterable with the first
limit
items ofiterable
.