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

x/better_iterators/mod.ts>RangeArgs

Chainable iterators (sync and async) for TypeScript, with support for opt-in, bounded parallelism
Latest
interface RangeArgs
import { type RangeArgs } from "https://deno.land/x/better_iterators@v1.5.0/mod.ts";

Properties

optional
from: number

default: 0

optional
to: number

default: Number.MAX_SAFE_INTEGER

optional
step: number

default: 1

optional
inclusive: boolean

default: false

Like ranges in many other languages, a range by default includes its start, but not its end. If true, this will cause the range to include its end.

import { range } from "./mod.ts"

// [1, 2]:
console.log(range({from: 1, to: 3}))

// [1, 2, 3]:
console.log(range({from: 1, to: 3, inclusive: true}))