MCPcopy
hub / github.com/ionic-team/capacitor / doesContainElements

Function doesContainElements

cli/src/cordova.ts:401–436  ·  view source on GitHub ↗
(requiredElementsArray: any[], existingElementsArray: any[])

Source from the content-addressed store, hash-verified

399 parsedRequiredElements.push(rootOfRequiredElementsToAdd);
400
401 const doesContainElements = (requiredElementsArray: any[], existingElementsArray: any[]) => {
402 for (const requiredElement of requiredElementsArray) {
403 if (requiredElement.name === 'key' || requiredElement.name === 'string') {
404 let foundMatch = false;
405 for (const existingElement of existingElementsArray) {
406 if (
407 existingElement.name === requiredElement.name &&
408 (existingElement.value === requiredElement.value ||
409 /^[$].{1,}$/.test((requiredElement.value as string).trim()))
410 ) {
411 foundMatch = true;
412 break;
413 }
414 }
415 if (!foundMatch) {
416 return false;
417 }
418 } else {
419 let foundMatch = false;
420 for (const existingElement of existingElementsArray) {
421 if (existingElement.name === requiredElement.name) {
422 if ((requiredElement.children !== undefined) === (existingElement.children !== undefined)) {
423 if (doesContainElements(requiredElement.children, existingElement.children)) {
424 foundMatch = true;
425 break;
426 }
427 }
428 }
429 }
430 if (!foundMatch) {
431 return false;
432 }
433 }
434 }
435 return true;
436 };
437
438 if (!doesContainElements(parsedRequiredElements, parsedExistingElements)) {
439 logPossibleMissingItem(configElement, plugin);

Callers 1

logiOSPlistFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected