random-code.js
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Random-code.js

Random-code.js is a library for generate random codes

Installation

npm install random-code.js

Usage

Generate Random Code With Default Options (length = 8)

const randomCode = require("random-code.js");

console.log(randomCode.generateOne()); // sITp9uJw

Generate Random Code With Custom Length

const randomCode = require("random-code.js");

console.log(randomCode.generateOne({
  length: 12
})); // uImr9EqYCN4P

Generate Random Code With Prefix

const randomCode = require("random-code.js");

console.log(randomCode.generateOne({
  prefix: "hello-"
})); // hello-ZVy2eVzw

Generate Random Code With Postfix

const randomCode = require("random-code.js");

console.log(randomCode.generateOne({
  postfix: "-world"
})); // FiutVAaq-world

Generate Random Code With Custom Length & Prefix & Postfix

const randomCode = require("random-code.js");

console.log(randomCode.generateOne({
  length: 12,
  prefix: "hello-",
  postfix: "-world"
})); // hello-q38AL3eAA7GA-world

Package Sidebar

Install

npm i random-code.js

Weekly Downloads

13

Version

1.0.2

License

ISC

Unpacked Size

2.76 kB

Total Files

5

Last publish

Collaborators

  • vmxitachi