This module adds a new hexaurl method to the Zod String schema.
This method validates that a string is in the HexaURL format, based on the specified byteSize and config.
Remarks
The config parameter is optional and can be customized as needed.
The default value of byteSize is 16 (can contain up to 21 characters).
Example
// Basic HexaURL validation
import { z } from"zod"; import"hexaurl-validate/zod"; // Ensure the module is imported to use the hexaurl method
constcustomSchema = z.string() .regex(/[0-9]$/, { message:"The string must end with a digit", }) .hexaurl(config, 8) // 8-byte HexaURL can contain up to 10 characters .transform(hexaurl=>`https://example.com/${hexaurl}`);
HexaURL validation extension for the Zod schema
This module adds a new hexaurl method to the Zod String schema. This method validates that a string is in the HexaURL format, based on the specified byteSize and config.
Remarks
Example
Example