generated from gxc-solutions/gxc-template-repo
Added first files
This commit is contained in:
parent
3be22f1023
commit
aad2fe13e7
29 changed files with 5020 additions and 8 deletions
10
lib/src/web-api/uuidv4.ts
Normal file
10
lib/src/web-api/uuidv4.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export const uuidv4 = () => {
|
||||
if (crypto.randomUUID == null) {
|
||||
"10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) =>
|
||||
// eslint-disable-next-line no-bitwise
|
||||
(+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16),
|
||||
);
|
||||
} else {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue