Package Exports
- randomkey
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (randomkey) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Randomkey
Lightweight node.js lib for generating random strings.
You can specify the length and character set to use.
If you specify length as an array [min, max] a number in the range will be
used.
The character set defaults to:
0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyzSeveral character sets are provided as properties of the function:
default:0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyzupper:ABCDEFGHIJKLMNOPQRSTUVWXTZlower:abcdefghijklmnopqrstuvwxtzalphanumeric:0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZnumbers:0123456789safe:2346789ABCDEFGHJKLMNPRTUVWXTZ
Usage
npm install --save randomkeyrandomkey(len, chars)
var rk = require('randomkey');
// generate a 10 character key using the default character set
var key = rk(10);
// generate a 6 character key using only the characters `a`, `b` and `c`
var abc = rk(10, 'abc');
// generate a 16 character key using the "safe" character set:
var safe = rk(16, rk.safe);
// generate a key between 5 and 10 characters long with the default characters:
var variableLength = rk([5,10]);