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

Function _resolveArray

src/helpers/helpers.config.ts:275–296  ·  view source on GitHub ↗
(
  prop: string,
  value: unknown[],
  target: ContextCache,
  isIndexable: (key: string) => boolean
)

Source from the content-addressed store, hash-verified

273}
274
275function _resolveArray(
276 prop: string,
277 value: unknown[],
278 target: ContextCache,
279 isIndexable: (key: string) => boolean
280) {
281 const {_proxy, _context, _subProxy, _descriptors: descriptors} = target;
282
283 if (typeof _context.index !== 'undefined' && isIndexable(prop)) {
284 return value[_context.index % value.length];
285 } else if (isObject(value[0])) {
286 // Array of objects, return array or resolvers
287 const arr = value;
288 const scopes = _proxy._scopes.filter(s => s !== arr);
289 value = [];
290 for (const item of arr) {
291 const resolver = createSubResolver(scopes, _proxy, prop, item);
292 value.push(_attachContext(resolver, _context, _subProxy && _subProxy[prop], descriptors));
293 }
294 }
295 return value;
296}
297
298function resolveFallback(
299 fallback: ResolverObjectKey | ((prop: ResolverObjectKey, value: unknown) => ResolverObjectKey),

Callers 1

_resolveWithContextFunction · 0.85

Calls 3

isObjectFunction · 0.85
createSubResolverFunction · 0.85
_attachContextFunction · 0.85

Tested by

no test coverage detected