MCPcopy
hub / github.com/chartjs/Chart.js / _each

Method _each

src/core/core.registry.js:124–146  ·  view source on GitHub ↗

* @private

(method, args, typedRegistry)

Source from the content-addressed store, hash-verified

122 * @private
123 */
124 _each(method, args, typedRegistry) {
125 [...args].forEach(arg => {
126 const reg = typedRegistry || this._getRegistryForType(arg);
127 if (typedRegistry || reg.isForType(arg) || (reg === this.plugins && arg.id)) {
128 this._exec(method, reg, arg);
129 } else {
130 // Handle loopable args
131 // Use case:
132 // import * as plugins from './plugins.js';
133 // Chart.register(plugins);
134 each(arg, item => {
135 // If there are mixed types in the loopable, make sure those are
136 // registered in correct registry
137 // Use case: (treemap exporting controller, elements etc)
138 // import * as treemap from 'chartjs-chart-treemap.js';
139 // Chart.register(treemap);
140
141 const itemReg = typedRegistry || this._getRegistryForType(item);
142 this._exec(method, itemReg, item);
143 });
144 }
145 });
146 }
147
148 /**
149 * @private

Callers 10

addMethod · 0.95
removeMethod · 0.95
addControllersMethod · 0.95
addElementsMethod · 0.95
addPluginsMethod · 0.95
addScalesMethod · 0.95
removeControllersMethod · 0.95
removeElementsMethod · 0.95
removePluginsMethod · 0.95
removeScalesMethod · 0.95

Calls 4

_getRegistryForTypeMethod · 0.95
_execMethod · 0.95
eachFunction · 0.85
isForTypeMethod · 0.80

Tested by

no test coverage detected