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

Function optionalStringRecord

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

Source from the content-addressed store, hash-verified

98}
99
100export function optionalStringRecord(key: string): ParamCheck {
101 return (record) => {
102 const value = record[key]
103 if (value === undefined) return null
104 if (typeof value !== "object" || value === null || Array.isArray(value)) return paramsError(`$.${key}`, `${key} must be an object`)
105 for (const [entryKey, entryValue] of Object.entries(value)) {
106 if (typeof entryValue !== "string") return paramsError(`$.${key}.${entryKey}`, `${key} values must be strings`)
107 }
108 return null
109 }
110}

Callers 3

commandParamsFunction · 0.90
scriptParamsFunction · 0.90
ptySpawnParamsFunction · 0.90

Calls 2

entriesMethod · 0.80
paramsErrorFunction · 0.70

Tested by

no test coverage detected