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

Function preParseFinder

_benchmarks/sample_echarts.js:7775–7813  ·  view source on GitHub ↗
(finderInput, opt)

Source from the content-addressed store, hash-verified

7773 return result;
7774 }
7775 function preParseFinder(finderInput, opt) {
7776 var finder;
7777
7778 if (isString(finderInput)) {
7779 var obj = {};
7780 obj[finderInput + 'Index'] = 0;
7781 finder = obj;
7782 } else {
7783 finder = finderInput;
7784 }
7785
7786 var queryOptionMap = createHashMap();
7787 var others = {};
7788 var mainTypeSpecified = false;
7789 each(finder, function (value, key) {
7790 // Exclude 'dataIndex' and other illgal keys.
7791 if (key === 'dataIndex' || key === 'dataIndexInside') {
7792 others[key] = value;
7793 return;
7794 }
7795
7796 var parsedKey = key.match(/^(\w+)(Index|Id|Name)$/) || [];
7797 var mainType = parsedKey[1];
7798 var queryType = (parsedKey[2] || '').toLowerCase();
7799
7800 if (!mainType || !queryType || opt && opt.includeMainTypes && indexOf(opt.includeMainTypes, mainType) < 0) {
7801 return;
7802 }
7803
7804 mainTypeSpecified = mainTypeSpecified || !!mainType;
7805 var queryOption = queryOptionMap.get(mainType) || queryOptionMap.set(mainType, {});
7806 queryOption[queryType] = value;
7807 });
7808 return {
7809 mainTypeSpecified: mainTypeSpecified,
7810 queryOptionMap: queryOptionMap,
7811 others: others
7812 };
7813 }
7814 var SINGLE_REFERRING = {
7815 useDefault: true,
7816 enableAll: false,

Callers 3

parseFinderFunction · 0.85
sample_echarts.jsFile · 0.85
findComponentReferenceFunction · 0.85

Calls 4

createHashMapFunction · 0.85
isStringFunction · 0.70
eachFunction · 0.70
indexOfFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…