(childElementsObj: any[], arrayToAddTo: any[])
| 329 | xml = `<plist version="1.0"><dict>${xml}</dict></plist>`; |
| 330 | |
| 331 | const parseXmlToSearchable = (childElementsObj: any[], arrayToAddTo: any[]) => { |
| 332 | for (const childElement of childElementsObj) { |
| 333 | const childElementName = childElement['#name']; |
| 334 | const toAdd: { |
| 335 | name: string; |
| 336 | attrs?: { [key: string]: any } | undefined; |
| 337 | children?: any[] | undefined; |
| 338 | value?: any | undefined; |
| 339 | } = { name: childElementName }; |
| 340 | if (childElementName === 'key' || childElementName === 'string') { |
| 341 | toAdd.value = childElement['_']; |
| 342 | } else { |
| 343 | if (childElement['$']) { |
| 344 | toAdd.attrs = { ...childElement['$'] }; |
| 345 | } |
| 346 | if (childElement['$$']) { |
| 347 | toAdd.children = []; |
| 348 | parseXmlToSearchable(childElement['$$'], toAdd['children']); |
| 349 | } |
| 350 | } |
| 351 | arrayToAddTo.push(toAdd); |
| 352 | } |
| 353 | }; |
| 354 | |
| 355 | const existingElements = parseXML(trimmedPlistData, { |
| 356 | explicitChildren: true, |
no outgoing calls
no test coverage detected