UNPKG

452 BJavaScriptView Raw
1var prefixCounts = new Map();
2// These IDs won't be globally unique, but they will be unique within this
3// process, thanks to the counter, and unguessable thanks to the random suffix.
4export function makeUniqueId(prefix) {
5 var count = prefixCounts.get(prefix) || 1;
6 prefixCounts.set(prefix, count + 1);
7 return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
8}
9//# sourceMappingURL=makeUniqueId.js.map
\No newline at end of file