You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
452 B
9 lines
452 B
4 months ago
|
var prefixCounts = new Map();
|
||
|
// These IDs won't be globally unique, but they will be unique within this
|
||
|
// process, thanks to the counter, and unguessable thanks to the random suffix.
|
||
|
export function makeUniqueId(prefix) {
|
||
|
var count = prefixCounts.get(prefix) || 1;
|
||
|
prefixCounts.set(prefix, count + 1);
|
||
|
return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
|
||
|
}
|
||
|
//# sourceMappingURL=makeUniqueId.js.map
|