import { dropUntil } from "https://deno.land/x/iter@v3.2.3/mod.ts";
Returns a new iterable which skips items from it
until f
returns true.
true.
Examples
Example 1
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 callsf
one time for each item in the iterable untilf
returns true.
Returns
A new iterable of it
which begins at the first element where f
returns true