Merge pull request #254 from quicujo/feat/validate-uuid

Add UUID validation utility
This commit is contained in:
dswbx
2025-09-14 13:19:57 +02:00
committed by GitHub

View File

@@ -1,10 +1,16 @@
import { v4, v7 } from "uuid";
import { v4, v7, validate, version as uuidVersion } from "uuid";
// generates v4
export function uuid(): string {
return v4();
return v4();
}
// generates v7
export function uuidv7(): string {
return v7();
return v7();
}
// validate uuid
export function uuidValidate(uuid: string, version: 4 | 7): boolean {
return validate(uuid) && uuidVersion(uuid) === version;
}