Skip to content

๐Ÿ” Customizable, secure ID generator with async support and prefix/suffix options for JS/TS

License

Notifications You must be signed in to change notification settings

SanyamPunia/unique-forge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

UniqueForge

Customizable and secure ID generator with async and prefix/suffix support for JS/TS environment.

Installation

npm install unique-forge

Usage

Basic ID Generation

Use UniqueForge for standard unique ID generation:

const { UniqueForge } = require("unique-forge");

const forge = new UniqueForge();
console.log(forge.generate()); // Outputs a unique ID

Asynchronous ID Generation

For asynchronous workflows, use AsyncUniqueForge:

const { AsyncUniqueForge } = require("unique-forge");

const asyncForge = new AsyncUniqueForge();
asyncForge.generate().then((id) => console.log(id));

Secure ID Generation

For cryptographically secure IDs, use SecureUniqueForge:

const { SecureUniqueForge } = require("unique-forge");

const secureForge = new SecureUniqueForge();
console.log(secureForge.generate()); // Outputs a secure unique ID

Customizable ID Generation

Use CustomUniqueForge for IDs with custom prefixes or suffixes:

const { CustomUniqueForge } = require("unique-forge");

const customForge = new CustomUniqueForge({ prefix: "user_", suffix: "_2023" });
console.log(customForge.generate()); // Outputs: user_<unique-id>_2023

Features

  • Customizable Alphabet: Define your own characters for ID generation.
  • Adjustable Length: Set the size of the generated IDs.
  • Synchronous & Asynchronous: Flexible workflows for various use cases.
  • Secure Random IDs: Leverage cryptographic randomness when needed.
  • Prefix/Suffix Support: Easily create formatted IDs.

License

This library is MIT Licensed. Contributions are welcome!

About

๐Ÿ” Customizable, secure ID generator with async support and prefix/suffix options for JS/TS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published