UNPKG

bguard

Version:

**bguard** is a powerful, flexible, and type-safe validation library for TypeScript. It allows developers to define validation schemas for their data structures and ensures that data conforms to the expected types and constraints.

25 lines (22 loc) 948 B
import { RequiredValidation } from '../../core.mjs'; import '../../commonTypes.mjs'; import '../../InferType.mjs'; import '../../helpers/constants.mjs'; /** * @description Asserts that a string value matches the UUID v5 format. * @returns {RequiredValidation} A validation function that takes a received string and an exception context. * @throws {ValidationError} if the received value is not a valid UUID v5. * @example * const schema = string().custom(uuidV5()); * parseOrFail(schema, '550e8400-e29b-51d4-a716-446655440000'); // Valid * parseOrFail(schema, '550e8400-e29b-41d4-a716-446655440000'); // Throws an error: 'The received value is not a valid UUID v5' * parseOrFail(schema, 'invalid-uuid'); // Throws an error: 'The received value is not a valid UUID v5' * * @translation Error Translation Key = 's:uuidV5' */ declare const uuidV5: { (): RequiredValidation; key: string; message: string; }; export { uuidV5 };