From 0c860ff463643be4c097bc31a8e8cbe655150873 Mon Sep 17 00:00:00 2001 From: Bosco Domingo Date: Sat, 9 Nov 2024 20:26:22 +0100 Subject: [PATCH] feat: simplify UUIDv7 logic --- src/domain/value_objects/uuidv7.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/domain/value_objects/uuidv7.ts b/src/domain/value_objects/uuidv7.ts index 9003524..2b5804a 100644 --- a/src/domain/value_objects/uuidv7.ts +++ b/src/domain/value_objects/uuidv7.ts @@ -9,11 +9,7 @@ export class UUIDv7 { return; } - if ( - !value?.match( - /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, - ) - ) { + if (!UUIDv7.validate(value)) { throw new Error("Invalid UUIDv7 format"); }