MCPcopy Create free account
hub / github.com/chhoumann/quickadd / keyFieldName

Method keyFieldName

src/utils/FieldSuggestionCache.ts:181–192  ·  view source on GitHub ↗

Decode the field-name component of a key produced by makeKey.

(key: string)

Source from the content-addressed store, hash-verified

179
180 /** Decode the field-name component of a key produced by {@link makeKey}. */
181 private keyFieldName(key: string): string | undefined {
182 try {
183 const parsed = JSON.parse(key) as unknown;
184 if (Array.isArray(parsed) && typeof parsed[0] === "string") {
185 return parsed[0];
186 }
187 } catch {
188 // Keys are always produced by makeKey, so this is unreachable in
189 // practice; fall through to undefined defensively.
190 }
191 return undefined;
192 }
193}

Callers 1

clearMethod · 0.95

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected