From 1163dee35260002feb0d69ec6a47589ff20fb474 Mon Sep 17 00:00:00 2001 From: devlikepro Date: Mon, 12 Aug 2024 10:21:45 +0700 Subject: [PATCH] [core] uuid4 --- src/utils/ids.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/ids.ts b/src/utils/ids.ts index e1634744..c5271142 100644 --- a/src/utils/ids.ts +++ b/src/utils/ids.ts @@ -1,4 +1,10 @@ +import { v4 as uuid4 } from 'uuid'; + +/** + * Generate prefix uuid (but remove -) + * @param prefix + */ export function generatePrefixedId(prefix: string) { - const id = Math.random().toString(36).substring(7); + const id = uuid4().replace(/-/g, ''); return `${prefix}_${id}`; }