Skip to main content

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

Works with
It is unknown whether this package works with 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
This package works with Browsers
JSR Score
94%
Published
2 months ago (1.0.0)

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 @lambdalisue/indexer

Import symbol

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

Add Package

npx jsr add @lambdalisue/indexer

Import symbol

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

Add Package

yarn dlx jsr add @lambdalisue/indexer

Import symbol

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

Add Package

pnpm dlx jsr add @lambdalisue/indexer

Import symbol

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

Add Package

bunx jsr add @lambdalisue/indexer

Import symbol

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