Takes while the element satisfies pred. If the element matches pred, the list will fuse at the element.
pred
The condition to decide to stop the list.
The filtered list.
const nums = range(1, 100);const takeWhileSquared = takeWhile((x: number) => x * x <= 20)(nums);expect(toArray(takeWhileSquared)).toStrictEqual([1, 2, 3, 4]); Copy
const nums = range(1, 100);const takeWhileSquared = takeWhile((x: number) => x * x <= 20)(nums);expect(toArray(takeWhileSquared)).toStrictEqual([1, 2, 3, 4]);
Takes while the element satisfies
pred. If the element matchespred, the list will fuse at the element.