MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / optionalString

Function optionalString

projects/runtime-node/src/validation.ts:37–43  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

35}
36
37export function optionalString(key: string): ParamCheck {
38 return (record) => {
39 const value = record[key]
40 if (value !== undefined && typeof value !== "string") return paramsError(`$.${key}`, `${key} must be a string`)
41 return null
42 }
43}
44
45export function optionalStringEnum(key: string, values: readonly string[]): ParamCheck {
46 return (record) => {

Calls 1

paramsErrorFunction · 0.70

Tested by

no test coverage detected