MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / findDictWithKey

Function findDictWithKey

src/utils/nskeyedarchiver-parser.ts:72–83  ·  view source on GitHub ↗

* Finds a dictionary that has the given key index in its NS.keys array

(objects: unknown[], keyIndex: number)

Source from the content-addressed store, hash-verified

70 * Finds a dictionary that has the given key index in its NS.keys array
71 */
72function findDictWithKey(objects: unknown[], keyIndex: number): ArchivedDict | undefined {
73 for (const obj of objects) {
74 if (typeof obj !== 'object' || obj === null) continue;
75 const dict = obj as ArchivedDict;
76 const keys = dict['NS.keys'];
77 if (!Array.isArray(keys)) continue;
78
79 const hasKey = keys.some((k) => isUID(k) && k.UID === keyIndex);
80 if (hasKey) return dict;
81 }
82 return undefined;
83}
84
85/**
86 * Gets the value for a key in an NS.keys/NS.objects dictionary

Callers 3

parseXcuserstateFunction · 0.85
parseXcuserstateBufferFunction · 0.85

Calls 1

isUIDFunction · 0.85

Tested by

no test coverage detected