MCPcopy
hub / github.com/tdewolff/minify / mappingById

Function mappingById

_benchmarks/sample_echarts.js:7405–7425  ·  view source on GitHub ↗
(result, existings, existingIdIdxMap, newCmptOptions)

Source from the content-addressed store, hash-verified

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.

Callers 1

mappingToExistsFunction · 0.85

Calls 3

makeComparableKeyFunction · 0.85
eachFunction · 0.70
assertFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…