MCPcopy Create free account
hub / github.com/arctic-cli/interface / fn

Function fn

packages/arctic/src/util/fn.ts:3–11  ·  view source on GitHub ↗
(schema: T, cb: (input: z.infer<T>) => Result)

Source from the content-addressed store, hash-verified

1import { z } from "zod"
2
3export function fn<T extends z.ZodType, Result>(schema: T, cb: (input: z.infer<T>) => Result) {
4 const result = (input: z.infer<T>) => {
5 const parsed = schema.parse(input)
6 return cb(parsed)
7 }
8 result.force = (input: z.infer<T>) => cb(input)
9 result.schema = schema
10 return result
11}

Callers 15

project.tsFile · 0.90
prompt.tsFile · 0.90
message-v2.tsFile · 0.90
index.tsFile · 0.90
summary.tsFile · 0.90
compaction.tsFile · 0.90
auth.tsFile · 0.90
workFunction · 0.70
lazyFunction · 0.70
[Symbol.dispose]Function · 0.70
[Symbol.asyncDispose]Function · 0.70
iifeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected