@commenthol/app-config
Version:
set values in global app configuration
31 lines (24 loc) • 554 B
JavaScript
import * as v from 'valibot'
export { v }
export const StringSchema = v.pipe(
v.string(),
v.minLength(1),
v.maxLength(1024)
)
export const IntegerSchema = v.pipe(
v.string(),
v.transform(Number),
v.integer()
)
export const PositiveNullIntegerSchema = v.pipe(
v.string(),
v.transform(Number),
v.integer(),
v.minValue(0)
)
export const NumberSchema = v.pipe(v.string(), v.transform(Number), v.integer())
export const BooleanSchema = v.pipe(
v.string(),
v.transform((val) => ['true', 'on', '1'].includes(val)),
v.boolean()
)