effect-io-ai

Package: effect
Module: Array

Array.dropWhile

Drops elements from the start while the predicate holds, returning the rest.

When to use

Use to remove a leading prefix of elements that satisfy a predicate.

Details

The predicate receives (element, index).

Example (Dropping while condition holds)

import { Array } from "effect"

console.log(Array.dropWhile([1, 2, 3, 4, 5], (x) => x < 4)) // [4, 5]

See

Signature

declare const dropWhile: { <A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Array<A>; <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Array<A>; }

Source

Since v2.0.0