Returns an OperationFunction that takes elements from the source while the predicate returns true.
true
Type of items in the source.
Predicate function to determine if an element should be taken.
An OperationFunction that takes elements from the source while the predicate returns true.
const result = takeWhile<number>((x) => x < 3)([1, 2, 3, 4]);console.log([...result]); // [1, 2] Copy
const result = takeWhile<number>((x) => x < 3)([1, 2, 3, 4]);console.log([...result]); // [1, 2]
Returns an OperationFunction that takes elements from the source while the predicate returns
true.