docs/fp/reference/dropWhile.md
Creates a function that drops leading values while a predicate passes. Use it with pipe.
const result = pipe(array, dropWhile(predicate));
::: info
Prefer the original es-toolkit dropWhile in ordinary code. Use this fp variant when composing transformations with pipe.
:::
dropWhile walks the piped array from the beginning and removes values while predicate returns true. It is lazy-capable inside pipe.
import { dropWhile, pipe } from 'es-toolkit/fp';
pipe(
[1, 2, 3, 1],
dropWhile(value => value < 3)
); // => [3, 1]
predicate ((item: T, index: number) => boolean): The function that decides whether a leading value should be dropped.((array: readonly T[]) => T[]): A function that maps a readonly T[] to the values left after dropping from the beginning.