anychar
v0.1.0
Published
Tiny, dependency-free generator for sequential string IDs
Downloads
35
Maintainers
Readme
anychar

- Incremental string generator for producing sequential, unique IDs
- ES6-compatible for use in all modern environments
- TypeScript-ready, shipped with built-in type definitions
- Fully customizable character set
- Can be resumed from any starting ID
- Lightweight, with zero external dependencies
Installation
npm install anycharnew AnyChar(options?)
Instantiates an incremental string generator. Every call to next() produces the next string in the sequence, cycling through the configured character set like a base-N counter cycles through digits.
||Description|Default|
|---|---|---|
|options.chars|The set of characters used to construct the generated strings.|A string containing digits (0-9), uppercase letters (A-Z), and lowercase letters (a-z).|
|options.startAt|The first value the generator will produce.|""|
import { AnyChar } from "anychar";
const anyChar = new AnyChar();
anyChar.next();
// "0"
anyChar.next();
// "1"
anyChar.next();
// "2"next()
Generates the next string in the sequence.
import { AnyChar } from "anychar";
const anyChar = new AnyChar({ chars: "ab" });
anyChar.next();
// "a"
anyChar.next();
// "b"
anyChar.next();
// "aa"
anyChar.next();
// "ab"
anyChar.next();
// "ba"import { AnyChar } from "anychar";
const anyChar = new AnyChar({ startAt: "z" });
anyChar.next();
// "z"
anyChar.next();
// "A"License
Copyright (C) 2026-present stldo
