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

Method makeKey

src/utils/FieldSuggestionCache.ts:171–178  ·  view source on GitHub ↗
(fieldName: string, cacheKey?: string)

Source from the content-addressed store, hash-verified

169 }
170
171 private makeKey(fieldName: string, cacheKey?: string): string {
172 // Encode both components unambiguously. A raw `${fieldName}:${cacheKey}`
173 // join collides when a field name itself contains a colon, e.g.
174 // makeKey("foo", "bar:baz") === makeKey("foo:bar", "baz"). JSON-encoding a
175 // tuple keeps every (fieldName, cacheKey) pair distinct. Empty/undefined
176 // cacheKey collapse to the same key (legacy behavior).
177 return JSON.stringify([fieldName, cacheKey || null]);
178 }
179
180 /** Decode the field-name component of a key produced by {@link makeKey}. */
181 private keyFieldName(key: string): string | undefined {

Calls

no outgoing calls

Tested by

no test coverage detected