Lazily takes the first n elements from the input sync iterable. Returns a sync iterable that yields the first n elements of the input sync iterable.
A function that accepts an input iterable and returns a sync iterable of the first n elements.
const input = [1, 2, 3, 4, 5];const firstThreeElements = takeSync(3)(input);for (const value of firstThreeElements) { console.log(value); // Logs 1, 2, and 3}
Available as take when imported from peter-piper/sync.
take
peter-piper/sync
The type of elements in the input iterable.
The number of elements to take from the input iterable.
Generated using TypeDoc
Lazily takes the first n elements from the input sync iterable. Returns a sync iterable that yields the first n elements of the input sync iterable.
Returns
A function that accepts an input iterable and returns a sync iterable of the first n elements.
Example
Remarks
Available as
take
when imported frompeter-piper/sync
.