1.1.0 • Published 1 year ago

generate-custom-id v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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

Licença

MIT

Authors

1.1.0

1 year ago

1.0.2

2 years ago

1.0.0

2 years ago