README
About
Advanced Id is an easy to use package to generate Ids. It will generate them based on the length and type you provided.
Simple and easy to use.
Table of Contents:
Changelog
Version 1.0.5 allows you to generate multiple Ids!.
The type is now also not inside the object anymore.
Example
Before you begin, please install the package with:
npm i advanced-id
Or with yarn:
yarn add advanced-id
Next, you need to import the package:
const ID = require('advanced-id');
Or:
import ID from 'advanced-id';
After that, you're almost ready to go.
Examples to generate an Id:
const ID = require('advanced-id');
const id = new ID();
console.log(id.generate("all", {length: 10})) //--> -=1cP--OJ+
console.log(id.generate("string", {length: 10})) //--> EfBgSGgEHp
console.log(id.generate("int", {length: 10})) //--> 4256080813
console.log(id.generate("symbol", {length: 10})) //--> ^*$%#-#!%#
Generate multiple Ids:
const ID = require('advanced-id');
const id = new ID();
console.log(id.generate("all", {length: 10, amount: 2})) //--> [ 'af!95chluZ', 'hgyQq*HwpW' ]
Options
Type | Description |
---|---|
all | Includes letters, integers, and symbols all into one id. |
string | Only includes letters into the id. |
int | Only includes integers into the id. |
symbol | Only includes symbols into the id. |
It will be defaulted to all if none is provided.
Option | Description | Default |
---|---|---|
type | String: Pass in what type the Id should be. | "all" |
length | Int: Pass in the length of the Id. | 1 - 20 |
amount | Int: The amount of Ids that should be generated. | 1 |