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

Function queryReferringComponents

_benchmarks/sample_echarts.js:7824–7861  ·  view source on GitHub ↗
(ecModel, mainType, userOption, opt)

Source from the content-addressed store, hash-verified

7822 enableNone: true
7823 };
7824 function queryReferringComponents(ecModel, mainType, userOption, opt) {
7825 opt = opt || SINGLE_REFERRING;
7826 var indexOption = userOption.index;
7827 var idOption = userOption.id;
7828 var nameOption = userOption.name;
7829 var result = {
7830 models: null,
7831 specified: indexOption != null || idOption != null || nameOption != null
7832 };
7833
7834 if (!result.specified) {
7835 // Use the first as default if `useDefault`.
7836 var firstCmpt = void 0;
7837 result.models = opt.useDefault && (firstCmpt = ecModel.getComponent(mainType)) ? [firstCmpt] : [];
7838 return result;
7839 }
7840
7841 if (indexOption === 'none' || indexOption === false) {
7842 assert(opt.enableNone, '`"none"` or `false` is not a valid value on index option.');
7843 result.models = [];
7844 return result;
7845 } // `queryComponents` will return all components if
7846 // both all of index/id/name are null/undefined.
7847
7848
7849 if (indexOption === 'all') {
7850 assert(opt.enableAll, '`"all"` is not a valid value on index option.');
7851 indexOption = idOption = nameOption = null;
7852 }
7853
7854 result.models = ecModel.queryComponents({
7855 mainType: mainType,
7856 index: indexOption,
7857 id: idOption,
7858 name: nameOption
7859 });
7860 return result;
7861 }
7862 function setAttribute(dom, key, value) {
7863 dom.setAttribute ? dom.setAttribute(key, value) : dom[key] = value;
7864 }

Callers 5

parseFinderFunction · 0.85
sample_echarts.jsFile · 0.85
findComponentReferenceFunction · 0.85

Calls 1

assertFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…