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

Function queryByIdOrName

_benchmarks/sample_echarts.js:18638–18658  ·  view source on GitHub ↗
(attr, idOrName, cmpts)

Source from the content-addressed store, hash-verified

18636 }
18637
18638 function queryByIdOrName(attr, idOrName, cmpts) {
18639 // Here is a break from echarts4: string and number are
18640 // treated as equal.
18641 if (isArray(idOrName)) {
18642 var keyMap_1 = createHashMap();
18643 each(idOrName, function (idOrNameItem) {
18644 if (idOrNameItem != null) {
18645 var idName = convertOptionIdName(idOrNameItem, null);
18646 idName != null && keyMap_1.set(idOrNameItem, true);
18647 }
18648 });
18649 return filter(cmpts, function (cmpt) {
18650 return cmpt && keyMap_1.get(cmpt[attr]);
18651 });
18652 } else {
18653 var idName_1 = convertOptionIdName(idOrName, null);
18654 return filter(cmpts, function (cmpt) {
18655 return cmpt && idName_1 != null && cmpt[attr] === idName_1;
18656 });
18657 }
18658 }
18659
18660 function filterBySubType(components, condition) {
18661 // Using hasOwnProperty for restrict. Consider

Callers 1

sample_echarts.jsFile · 0.85

Calls 5

createHashMapFunction · 0.85
convertOptionIdNameFunction · 0.85
isArrayFunction · 0.70
eachFunction · 0.70
filterFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…