UNPKG

magicbell

Version:
14 lines 514 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateID = generateID; const getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues ? () => crypto.getRandomValues(new Uint32Array(1))[0].toString(36) : () => Math.random().toString(36).substring(2, 15); function generateID(length = 17) { let id = ''; while (id.length < length) { id += getRandomValues(); } return id.substring(0, length); } //# sourceMappingURL=crypto.js.map