Produces up to the specified number of elements from the beginning of the source iterable.
Element type produced by the source iterable.
Source iterable to enumerate.
Maximum number of elements to yield; non-positive values return an empty iterable.
A deferred iterable yielding at most numItems elements from src.
numItems
src
const firstTwo = [..._take([1, 2, 3, 4], 2)];console.log(firstTwo); // [1, 2] Copy
const firstTwo = [..._take([1, 2, 3, 4], 2)];console.log(firstTwo); // [1, 2]
or using the curried version:
const firstTwo = [ ...pipeInto( [1, 2, 3, 4], take(2) ),];console.log(firstTwo); // [1, 2] Copy
const firstTwo = [ ...pipeInto( [1, 2, 3, 4], take(2) ),];console.log(firstTwo); // [1, 2]
Produces up to the specified number of elements from the beginning of the source iterable.