@yogesh_4242/random-id
v1.0.4
Published
Generate random alphanumeric IDs
Readme
@yogesh_4242/random-id
A tiny, fast, zero-dependency TypeScript library for generating random alphanumeric IDs.
Features
- 🚀 Lightweight
- ⚡ Fast
- 📦 Zero dependencies
- 🔷 TypeScript support
- 🌍 Works in Node.js, React, Next.js, and Vite
Installation
npm install @yogesh_4242/random-idUsage
JavaScript (CommonJS)
const { randomId } = require("@yogesh_4242/random-id");
console.log(randomId());TypeScript / ES Modules
import { randomId } from "@yogesh_4242/random-id";
console.log(randomId());API
randomId(length?: number)
Generates a random alphanumeric string.
| Parameter | Type | Default | |-----------|------|---------| | length | number | 10 |
Example:
randomId();Returns
YZWwrEuu6YExample:
randomId(20);Returns
Hk29LmPQ8AzYRt2QX1KmLicense
MIT © Yogesh S
