@qrvey/id-generator
The @qrvey/id-generator
package provides a simple utility function to generate unique IDs using the nanoid library, with customizable alphabet and length.
Installation
You can install the package using npm or yarn:
npm install @qrvey/id-generator
Or with yarn:
yarn add @qrvey/id-generator
Usage
The getId function allows you to generate unique IDs with a customizable alphabet and length.
Default Configuration
alphabet
: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzlength
: 21
Basic Example
import { getId } from '@qrvey/id-generator';
const id = getId();
console.log(id);
Custom Alphabet and Length
import { getId } from '@qrvey/id-generator';
const customAlphabet = '0123456789abcdef';
const customLength = 10;
const customId = getId(customAlphabet, customLength);
console.log(customId);