* Gets the value for a key in an NS.keys/NS.objects dictionary
(objects: unknown[], dict: ArchivedDict, keyIndex: number)
| 86 | * Gets the value for a key in an NS.keys/NS.objects dictionary |
| 87 | */ |
| 88 | function getValueForKey(objects: unknown[], dict: ArchivedDict, keyIndex: number): unknown { |
| 89 | const keys = dict['NS.keys']; |
| 90 | const values = dict['NS.objects']; |
| 91 | |
| 92 | if (!Array.isArray(keys) || !Array.isArray(values)) return undefined; |
| 93 | |
| 94 | const keyPosition = keys.findIndex((k) => isUID(k) && k.UID === keyIndex); |
| 95 | if (keyPosition === -1 || keyPosition >= values.length) return undefined; |
| 96 | |
| 97 | return resolveUID(objects, values[keyPosition]); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Main entry point: parses xcuserstate file and extracts Xcode state |
no test coverage detected