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

Function optionalStringArray

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

Source from the content-addressed store, hash-verified

86}
87
88export function optionalStringArray(key: string): ParamCheck {
89 return (record) => {
90 const value = record[key]
91 if (value === undefined) return null
92 if (!Array.isArray(value)) return paramsError(`$.${key}`, `${key} must be an array`)
93 for (let i = 0; i < value.length; i++) {
94 if (typeof value[i] !== "string") return paramsError(`$.${key}[${i}]`, `${key} entries must be strings`)
95 }
96 return null
97 }
98}
99
100export function optionalStringRecord(key: string): ParamCheck {
101 return (record) => {

Callers 1

commandParamsFunction · 0.90

Calls 1

paramsErrorFunction · 0.70

Tested by

no test coverage detected