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

Function mappingByName

_benchmarks/sample_echarts.js:7427–7446  ·  view source on GitHub ↗
(result, newCmptOptions)

Source from the content-addressed store, hash-verified

7425 }
7426
7427 function mappingByName(result, newCmptOptions) {
7428 // Mapping by name if specified.
7429 each(newCmptOptions, function (cmptOption, index) {
7430 if (!cmptOption || cmptOption.name == null) {
7431 return;
7432 }
7433
7434 for (var i = 0; i < result.length; i++) {
7435 var existing = result[i].existing;
7436
7437 if (!result[i].newOption // Consider name: two map to one.
7438 // Can not match when both ids existing but different.
7439 && existing && (existing.id == null || cmptOption.id == null) && !isComponentIdInternal(cmptOption) && !isComponentIdInternal(existing) && keyExistAndEqual('name', existing, cmptOption)) {
7440 result[i].newOption = cmptOption;
7441 newCmptOptions[index] = null;
7442 return;
7443 }
7444 }
7445 });
7446 }
7447
7448 function mappingByIndex(result, newCmptOptions, brandNew) {
7449 each(newCmptOptions, function (cmptOption) {

Callers 1

mappingToExistsFunction · 0.85

Calls 3

isComponentIdInternalFunction · 0.85
keyExistAndEqualFunction · 0.85
eachFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…