ekangularbase
Version:
Authentication service for usermanagement(oidc client)
24 lines (21 loc) • 710 B
text/typescript
export class Guid {
static newGuid() {
// return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
// const r = Math.random() * 16 | 0,
// v = c === 'x' ? r : (r & 0x3 | 0x8);
// return v.toString(16);
// });
let result: string;
let i: string;
let j: number;
result = '';
for (j = 0; j < 32; j++) {
if (j === 8 || j === 12 || j === 16 || j === 20) {
result = result + '-';
}
i = Math.floor(Math.random() * 16).toString(16).toUpperCase();
result = result + i;
}
return result;
}
}