MCPcopy Index your code
hub / github.com/cameri/nostream / pathExistsInSchema

Function pathExistsInSchema

src/cli/utils/config.ts:220–240  ·  view source on GitHub ↗
(schema: unknown, tokens: PathToken[])

Source from the content-addressed store, hash-verified

218}
219
220const pathExistsInSchema = (schema: unknown, tokens: PathToken[]): boolean => {
221 let current: unknown = schema
222
223 for (const token of tokens) {
224 if (token.type === 'key') {
225 if (!isPlainObject(current) || !(token.key in current)) {
226 return false
227 }
228 current = (current as Record<string, unknown>)[token.key]
229 continue
230 }
231
232 if (!Array.isArray(current)) {
233 return false
234 }
235
236 current = current[0]
237 }
238
239 return true
240}
241
242export const ensureSettingsExists = (): void => {
243 const configDir = getConfigBaseDir()

Callers 1

Calls 1

isPlainObjectFunction · 0.85

Tested by

no test coverage detected