Produces elements from the source iterable while the predicate returns a truthy value.
Element type produced by the source iterable.
Source iterable to enumerate.
Predicate receiving each element and its index; iteration stops once it returns a falsy value.
A deferred iterable yielding the leading elements that satisfy pred.
pred
Error Rethrows any error thrown by pred.
const leadingSmall = [..._takeWhile([1, 2, 3, 2], (value) => value < 3)];console.log(leadingSmall); // [1, 2] Copy
const leadingSmall = [..._takeWhile([1, 2, 3, 2], (value) => value < 3)];console.log(leadingSmall); // [1, 2]
or using the curried version:
const leadingSmall = [ ...pipeInto( [1, 2, 3, 2], takeWhile((value) => value < 3) ),];console.log(leadingSmall); // [1, 2] Copy
const leadingSmall = [ ...pipeInto( [1, 2, 3, 2], takeWhile((value) => value < 3) ),];console.log(leadingSmall); // [1, 2]
Produces elements from the source iterable while the predicate returns a truthy value.