globalbridge-lsf-custom
Version:
GlobalBridge in-house labeling tool, originating from LSF.
17 lines (13 loc) • 401 B
text/typescript
/**
* Unique hash generator
* @param {number} desiredLength
*/
export const guidGenerator = (desiredLength = 10) => {
let eventId = '';
while (eventId.length < desiredLength) {
const randomValue = (crypto.getRandomValues(new Uint32Array(1))[0] / 2 ** 32).toString();
eventId += randomValue;
}
// Trim the string to the desired length
return eventId.slice(2, desiredLength);
};