bbo
Version:
bbo is a utility library of zero dependencies for javascript.
16 lines (11 loc) • 416 B
JavaScript
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;
};
export default randomKey;