Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

random-keygen

1.0.4 • Public • Published

Random Keygen Build Status

Random-Keygen NPM

Simple random key and unique keys.

Install

  npm install random-keygen --save

Or

  yarn add random-keygen

Usage

get([options])

Random one key with the given options. Returns a string.

var randkey = require('random-keygen');
 
var key = randkey.get({
    length: 10,
    numbers: true
});
 
console.log(key);

getMulti(amount[, options])

Bulk create multiple keys at once, with the same options for all. Returns an array.

var randkey = require('random-keygen');
 
var keys = randkey.getMulti(3, {
    length: 10,
    uppercase: false
});
 
console.log(keys);

Options

Any of these can be passed into the options object for each function.

Name Description Default Value
length Integer, length of key. 10
numbers Boolean, put numbers in key. false
symbols Boolean, put symbols in key. false
uppercase Boolean, use uppercase letters in key. true
excludeSimilarCharacters Boolean, exclude similar chars, like 'i' and 'l'. false
exclude String, characters to be excluded from key. ''
strict Boolean, key must include at least one character from each pool. false

TopDev - Việc làm IT

Install

npm i random-keygen

DownloadsWeekly Downloads

13

Version

1.0.4

License

MIT

Unpacked Size

91.9 kB

Total Files

12

Homepage

topdev.vn

Last publish

Collaborators

  • avatar