import { drop } from "https://deno.land/x/aitertools@0.5.0/mod.ts";
Drops a specified number of elements from the beginning of an async iterable, and yields the remaining elements.
import { drop } from "./drop.ts";
async function* gen() { yield "foo"; yield "bar"; yield "baz"; yield "qux" }
const iterable = drop(gen(), 2);
for await (const value of iterable) {
console.log(value);
}
The above example will print the following 2 lines:
baz
qux
If the iterable is shorter than or equal to the specified number, no elements are yielded.
import { drop } from "./drop.ts";
async function* gen() { yield "foo"; yield "bar"; yield "baz"; yield "qux" }
const iterable = drop(gen(), 4);
for await (const value of iterable) {
console.log(value);
}
The above example will print nothing.