generate-custom-id
v1.1.0
Published
Generate a simple custom random ID
Downloads
34
Readme
Generate Custom Random ID
Simple custom random ID generator with Prefix and Suffix options
Installation
Install generate-custom-id with npm
npm install generate-custom-id
Install generate-custom-id with yarn
yarn add generate-custom-id
Usage/Examples
Simple generation with a single name:
import { idGenerator } from "generate-custom-id";
const id = idGenerator("example"); //0505ompj
Simple generation with more characters:
import { idGenerator } from "generate-custom-id";
const id = idGenerator("example", 4); //373AfhcfAc7E
Custom generation with options
import { idGenerator } from "generate-custom-id";
const options = {
prefix: "pre",
sufix: "suf",
trace: true,
};
const id = idGenerator("example", 2, 4, options); //pre-04Op40pz-suf
More options...
import { idGenerator } from "generate-custom-id";
const options = {
prefix: {
prefix: "pre",
trace: false,
},
sufix: "suf",
trace: true,
};
const id = idGenerator("example", 4, options); //pre323vPpY2-suf