type-arango
Version:
ArangoDB Foxx decorators and utilities for TypeScript
21 lines • 659 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.randomString = void 0;
/**
* Generate random string
* - default length is 10
*/
function randomString(len, charset) {
if (len === void 0) { len = 10; }
if (charset === void 0) { charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; }
if (len < 1)
len = 10;
if (charset === '0-9')
charset = '0123456789';
var code = '';
for (var i = 0; i < len; i++)
code += charset.charAt(Math.floor(Math.random() * charset.length));
return code;
}
exports.randomString = randomString;
//# sourceMappingURL=string.js.map