Skip to main content

Built and signed on GitHub Actions

itertools for Deno 🦕

This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 months ago (0.3.0)
function count
count(
start?: number,
step?: number,
): Generator<number>

Creates an iterator that returns evenly spaced values.

Examples

Example 1

import { assertEquals } from "@std/assert";

const counter = count(10, 2);
assertEquals(counter.next().value, 10);
assertEquals(counter.next().value, 12);
assertEquals(counter.next().value, 14);

Parameters

optional
start: number = 0
  • Starting number (defaults to 0)
optional
step: number = 1
  • Step size (defaults to 1)

Return Type

Add Package

deno add jsr:@gabelluardo/itertools

Import symbol

import { count } from "@gabelluardo/itertools";

---- OR ----

Import directly with a jsr specifier

import { count } from "jsr:@gabelluardo/itertools";

Add Package

npx jsr add @gabelluardo/itertools

Import symbol

import { count } from "@gabelluardo/itertools";

Add Package

yarn dlx jsr add @gabelluardo/itertools

Import symbol

import { count } from "@gabelluardo/itertools";

Add Package

pnpm dlx jsr add @gabelluardo/itertools

Import symbol

import { count } from "@gabelluardo/itertools";

Add Package

bunx jsr add @gabelluardo/itertools

Import symbol

import { count } from "@gabelluardo/itertools";