Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

randomcode

alekitopi9MIT1.0.1

Generate codes with diferent types of characters and length.

randomcode, gencode, random, code, generate, id, idgen, generateid, generatecode

readme

Randomcode

How to install

To install Randomcode, you need to execute this command in your project's folder.

npm install Randomcode --save

How to use

To start using Randomcode, you need to add the module to the file.

var gen = require('randomcode');

To generate a basic code, call the function like this:

gen(8);
// Output: Dk4CJl7D

In this case, "8" is the length of the code.

Randomcode, have 3 diferent modes: 0 => Normal, all the characters. 1 => Only letters. 2 => Only numbers

To set the mode for the code, you need to add it in the function like this:

gen(8, 0);    // Output: ia8kfY4X
gen(8, 1);    // Output: liJqgUVi
gen(8, 2);    // Output: 29172567