uuid
Accepts strings that are valid UUIDs (universally unique identifiers).Type Signature
Validation Pattern
Validates the standard UUID format:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Regex pattern:
- 8 hex digits
- hyphen
- 4 hex digits
- hyphen
- 4 hex digits
- hyphen
- 4 hex digits
- hyphen
- 12 hex digits
Valid Inputs
Invalid Inputs
Error Message
When validation fails:"Must be uuid"
Implementation
src/strings.ts:117-120
Related Decoders
- uuidv1 - Only accept UUIDv1 (date-time and MAC address)
- uuidv4 - Only accept UUIDv4 (random)
- regex - Create custom string pattern validators
uuidv1
Likeuuid, but only accepts UUIDv1 strings.
UUIDv1 is based on date-time and MAC address. The version digit (at position 14) must be '1'.
Type Signature
Valid Inputs
Invalid Inputs
Error Messages
- Not a UUID:
"Must be uuid" - Not version 1:
"Must be uuidv1"
Implementation
src/strings.ts:127-129
uuidv4
Likeuuid, but only accepts UUIDv4 strings.
UUIDv4 is randomly generated. The version digit (at position 14) must be '4'.
Type Signature
Valid Inputs
Invalid Inputs
Error Messages
- Not a UUID:
"Must be uuid" - Not version 4:
"Must be uuidv4"
Implementation
src/strings.ts:136-138