build
This commit is contained in:
parent
e36137e33e
commit
f6dcff3693
5 changed files with 6 additions and 10 deletions
|
|
@ -25,7 +25,7 @@ export const validarUuid = (uuid: string | number | undefined | null) => {
|
|||
* @param grupo - Opcional. Namespace para separar domínios diferentes de UUIDs.
|
||||
* @returns UUID v3 (determinístico)
|
||||
*/
|
||||
export const uuidV3 = (chave: any, grupo?: string | number): string => {
|
||||
export const uuidV3 = (chave: any, grupo?: any): string => {
|
||||
return v3(
|
||||
// Converte a chave para string (de forma segura)
|
||||
typeof chave === "string"
|
||||
|
|
@ -35,11 +35,7 @@ export const uuidV3 = (chave: any, grupo?: string | number): string => {
|
|||
: JSON.stringify(chave),
|
||||
|
||||
// Se um grupo foi fornecido, gera um UUID v3 recursivamente com base nele, senão usa NIL
|
||||
grupo
|
||||
? typeof grupo == "string" && validarUuid(grupo)
|
||||
? grupo
|
||||
: uuidV3(grupo)
|
||||
: NIL,
|
||||
grupo ? uuidV3(grupo) : NIL,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue