Skip to main content

Built and signed on GitHub Actions

🦕 The indexer library is a Deno module that provides a class called Indexer, which generates index numbers.

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
94%
Published
a year ago (1.0.0)

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

indexer

jsr denoland deno doc Test

The indexer library is a Deno module that provides a class called Indexer, which generates index numbers.

Usage

To use the Indexer class, you first need to import it from the indexer module:

import { Indexer } from "@lambdalisue/indexer";

You can then create a new instance of the Indexer class with an optional max value:

const indexer = new Indexer(10);

This creates an Indexer instance with a maximum index value of 10. If the max parameter is omitted, the maximum safe integer value will be used instead.

You can generate index numbers by calling the next() method on the Indexer instance:

const index1 = indexer.next(); // 0
const index2 = indexer.next(); // 1
const index3 = indexer.next(); // 2
// ...
const index10 = indexer.next(); // 9

When the index number reaches the maximum value, it will be reset to 0 and the next() method will start generating index numbers from 0 again.

License

The code follows the MIT license written in LICENSE. Contributors need to agree that any modifications sent in this repository follow the license.

Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@lambdalisue/indexer

Import symbol

import * as indexer from "@lambdalisue/indexer";

---- OR ----

Import directly with a jsr specifier

import * as indexer from "jsr:@lambdalisue/indexer";

Add Package

npx jsr add @lambdalisue/indexer

Import symbol

import * as indexer from "@lambdalisue/indexer";

Add Package

yarn dlx jsr add @lambdalisue/indexer

Import symbol

import * as indexer from "@lambdalisue/indexer";

Add Package

pnpm dlx jsr add @lambdalisue/indexer

Import symbol

import * as indexer from "@lambdalisue/indexer";

Add Package

bunx jsr add @lambdalisue/indexer

Import symbol

import * as indexer from "@lambdalisue/indexer";