mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-18 16:40:14 +00:00
14 lines
348 B
TypeScript
14 lines
348 B
TypeScript
/**
|
|
* This function returns a random identifier.
|
|
* @returns
|
|
*/
|
|
const guidGenerator = () => {
|
|
const S4 = () => {
|
|
// eslint-disable-next-line no-bitwise
|
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
};
|
|
return `${S4() + S4()}-${S4()}-${S4()}-${S4()}-${S4()}${S4()}${S4()}`;
|
|
};
|
|
|
|
export default guidGenerator;
|