@progress/kendo-angular-common
Version:
Kendo UI for Angular - Utility Package
30 lines (29 loc) • 958 B
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
/**
* @hidden
*/
export const guid = () => {
let id = "";
for (let i = 0; i < 32; i++) {
const random = Math.random() * 16 | 0; // eslint-disable-line no-bitwise
if (i === 8 || i === 12 || i === 16 || i === 20) {
id += "-";
}
let charValue;
if (i === 12) {
charValue = 4;
}
else if (i === 16) {
// eslint-disable-next-line no-bitwise
charValue = random & 3 | 8;
}
else {
charValue = random;
}
id += charValue.toString(16);
}
return id;
};