UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

18 lines (12 loc) 433 B
'use strict'; var randomKey = function () { var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32; /** Removed confusing characters 'oOLl,9gq,Vv,Uu,I1' **/ var possible = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; var key = ''; for (var i = 0; i < len; i++) { key += possible.charAt(Math.floor(Math.random() * possible.length)); } return key; }; module.exports = randomKey;