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

Method resolveNamedOptions

src/core/core.config.js:351–367  ·  view source on GitHub ↗

* @param {object[]} scopes * @param {string[]} names * @param {function|object} context * @param {string[]} [prefixes] * @return {object}

(scopes, names, context, prefixes = [''])

Source from the content-addressed store, hash-verified

349 * @return {object}
350 */
351 resolveNamedOptions(scopes, names, context, prefixes = ['']) {
352 const result = {$shared: true};
353 const {resolver, subPrefixes} = getResolver(this._resolverCache, scopes, prefixes);
354 let options = resolver;
355 if (needContext(resolver, names)) {
356 result.$shared = false;
357 context = isFunction(context) ? context() : context;
358 // subResolver is passed to scriptable options. It should not resolve to hover options.
359 const subResolver = this.createResolver(scopes, context, subPrefixes);
360 options = _attachContext(resolver, context, subResolver);
361 }
362
363 for (const prop of names) {
364 result[prop] = options[prop];
365 }
366 return result;
367 }
368
369 /**
370 * @param {object[]} scopes

Callers 1

Calls 5

createResolverMethod · 0.95
getResolverFunction · 0.85
needContextFunction · 0.85
isFunctionFunction · 0.85
_attachContextFunction · 0.85

Tested by

no test coverage detected