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

x/iter/mod.ts>drop

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

Returns a new iterable containing the items of it except the first n items.

Examples

Example 1

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

const numbers = iter.create.range(1, 10);
const from7 = iter.drop(numbers, 6);

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

// -> 7
// -> 8
// -> 9
// -> 10

Parameters

it: Iterable<T>
  • The iterable being taken from.
n: number
  • The number of items to drop.

Returns

A new iterable of it which skips the first n items.