MCPcopy Create free account
hub / github.com/chartjs/Chart.js / _resolveScriptable

Function _resolveScriptable

src/helpers/helpers.config.ts:255–273  ·  view source on GitHub ↗
(
  prop: string,
  getValue: (ctx: AnyObject, sub: AnyObject) => unknown,
  target: ContextCache,
  receiver: AnyObject
)

Source from the content-addressed store, hash-verified

253}
254
255function _resolveScriptable(
256 prop: string,
257 getValue: (ctx: AnyObject, sub: AnyObject) => unknown,
258 target: ContextCache,
259 receiver: AnyObject
260) {
261 const {_proxy, _context, _subProxy, _stack} = target;
262 if (_stack.has(prop)) {
263 throw new Error('Recursion detected: ' + Array.from(_stack).join('->') + '->' + prop);
264 }
265 _stack.add(prop);
266 let value = getValue(_context, _subProxy || receiver);
267 _stack.delete(prop);
268 if (needsSubResolver(prop, value)) {
269 // When scriptable option returns an object, create a resolver on that.
270 value = createSubResolver(_proxy._scopes, _proxy, prop, value);
271 }
272 return value;
273}
274
275function _resolveArray(
276 prop: string,

Callers 1

_resolveWithContextFunction · 0.85

Calls 4

needsSubResolverFunction · 0.85
createSubResolverFunction · 0.85
hasMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected