Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fathym_common/src/src.deps.ts>dropWhile

The Fathym Reference Architecture provides the common foundation for applications built in Typescript.
Go to Latest
function dropWhile
import { dropWhile } from "https://deno.land/x/fathym_common@v0.0.158/src/src.deps.ts";

Returns a new array that drops all elements in the given collection until the first element that does not match the given predicate.

Examples

Example 1

import { dropWhile } from "https://deno.land/std@0.224.0/collections/drop_while.ts";
import { assertEquals } from "https://deno.land/std@0.224.0/assert/assert_equals.ts";

const numbers = [3, 2, 5, 2, 5];
const dropWhileNumbers = dropWhile(numbers, (i) => i !== 2);

assertEquals(dropWhileNumbers, [2, 5, 2, 5]);

Parameters

array: readonly T[]
predicate: (el: T) => boolean