diff --git a/src/lib/common/utils/index.ts b/src/lib/common/utils/index.ts new file mode 100644 index 0000000..730dc2b --- /dev/null +++ b/src/lib/common/utils/index.ts @@ -0,0 +1 @@ +export { default as uuidv4 } from './uuidv4'; diff --git a/src/lib/common/utils/uuidv4.ts b/src/lib/common/utils/uuidv4.ts new file mode 100644 index 0000000..171ba15 --- /dev/null +++ b/src/lib/common/utils/uuidv4.ts @@ -0,0 +1,9 @@ +function uuidv4() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { + const random = (Math.random() * 16) | 0; + const result = c == 'x' ? random : (random & 0x3) | 0x8; + return result.toString(16); + }); +} + +export default uuidv4;