mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor: sizesSchema
This commit is contained in:
parent
c411a871ef
commit
34d604dded
1 changed files with 3 additions and 1 deletions
|
|
@ -66,7 +66,9 @@ const localeSchema = z.string().transform<Intl.Locale>((val, ctx) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
/** White-space separated list of sizes, each in the format <number with up to 4 digits>x<number with up to 4 digits> or with "X" in upper case. */
|
/** White-space separated list of sizes, each in the format <number with up to 4 digits>x<number with up to 4 digits> or with "X" in upper case. */
|
||||||
const sizesSchema = z.string().regex(/^(?:[1-9]\d{0,3}[xX][1-9]\d{0,3})(?:\s+[1-9]\d{0,3}[xX][1-9]\d{0,3})*$/);
|
const sizesSchema = z.string().refine((value) =>
|
||||||
|
value.split(' ').every((v) => /^[1-9]\d{0,3}[xX][1-9]\d{0,3}$/.test(v))
|
||||||
|
);
|
||||||
|
|
||||||
export {
|
export {
|
||||||
booleanParamSchema,
|
booleanParamSchema,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue