mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
11 lines
322 B
TypeScript
11 lines
322 B
TypeScript
import { z } from 'zod';
|
|
|
|
export const optionalBooleanSchema = z
|
|
.enum(['true', 'false'])
|
|
.optional()
|
|
.transform((value) => value !== undefined ? value === 'true' : undefined);
|
|
|
|
export const optionalNumberSchema = z
|
|
.string()
|
|
.optional()
|
|
.transform((value) => value !== undefined ? Number(value) : undefined);
|