(result, existings, existingIdIdxMap, newCmptOptions)
| 7403 | } |
| 7404 | |
| 7405 | function mappingById(result, existings, existingIdIdxMap, newCmptOptions) { |
| 7406 | // Mapping by id if specified. |
| 7407 | each(newCmptOptions, function (cmptOption, index) { |
| 7408 | if (!cmptOption || cmptOption.id == null) { |
| 7409 | return; |
| 7410 | } |
| 7411 | |
| 7412 | var optionId = makeComparableKey(cmptOption.id); |
| 7413 | var existingIdx = existingIdIdxMap.get(optionId); |
| 7414 | |
| 7415 | if (existingIdx != null) { |
| 7416 | var resultItem = result[existingIdx]; |
| 7417 | assert(!resultItem.newOption, 'Duplicated option on id "' + optionId + '".'); |
| 7418 | resultItem.newOption = cmptOption; // In both mode, if id matched, new option will be merged to |
| 7419 | // the existings rather than creating new component model. |
| 7420 | |
| 7421 | resultItem.existing = existings[existingIdx]; |
| 7422 | newCmptOptions[index] = null; |
| 7423 | } |
| 7424 | }); |
| 7425 | } |
| 7426 | |
| 7427 | function mappingByName(result, newCmptOptions) { |
| 7428 | // Mapping by name if specified. |
no test coverage detected
searching dependent graphs…