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

x/iter/lib/transformers.ts>dropUntil

A bunch of utilities for working with iterables, many inspired by the native array methods.
Latest
function dropUntil
import { dropUntil } from "https://deno.land/x/iter@v3.2.3/lib/transformers.ts";

Returns a new iterable which skips items from it until f returns true. true.

Examples

Example 1

import * as iter from "https://deno.land/x/iter/mod.ts";

const numbers = iter.create.range(1, 10);
const dropped = iter.dropUntil(numbers, (n) => n >= 5);

for (const num of dropped) {
  console.log(num);
}

// -> 5
// -> 6
// -> 7
// -> 8
// -> 9
// -> 10

Parameters

it: Iterable<T>
  • The iterable being skipped.
  • A function that accepts up to three arguments. The dropUntil function calls f one time for each item in the iterable until f returns true.
optional
includeFirst = [UNSUPPORTED]
  • Whether the item for which f returns true should be included.

Returns

A new iterable of it which begins at the first element where f returns true