This commit is contained in:
Frank
2025-09-18 10:59:01 -04:00
parent c87480cf93
commit 4ceabdffa0
156 changed files with 427 additions and 429 deletions

View File

@@ -0,0 +1,11 @@
import { z } from "zod"
export function fn<T extends z.ZodType, Result>(schema: T, cb: (input: z.infer<T>) => Result) {
const result = (input: z.infer<T>) => {
const parsed = schema.parse(input)
return cb(parsed)
}
result.force = (input: z.infer<T>) => cb(input)
result.schema = schema
return result
}