You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
579 B
20 lines
579 B
var randomBytes = require('./randomBytes');
|
|
var defSymbols =
|
|
'ModuleSymbhasOwnPr-0123456789ABCDEFGHIJKLNQRTUVWXYZ_cfgijkpqtvxz';
|
|
exports = function() {
|
|
var size =
|
|
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 21;
|
|
var symbols =
|
|
arguments.length > 1 && arguments[1] !== undefined
|
|
? arguments[1]
|
|
: defSymbols;
|
|
var id = '';
|
|
var len = symbols.length;
|
|
var bytes = randomBytes(21);
|
|
while (0 < size--) {
|
|
id += symbols[bytes[size] % len];
|
|
}
|
|
return id;
|
|
};
|
|
|
|
module.exports = exports;
|
|
|