MCPcopy Create free account
hub / github.com/ampproject/amphtml / calcRecursive

Function calcRecursive

src/core/context/values.js:701–713  ·  view source on GitHub ↗

* Whether the parent value is required to calculate the used value. * * @param {IContextProp } prop * @param {T[]|undefined} inputs * @return {boolean} * @template T

(prop, inputs)

Source from the content-addressed store, hash-verified

699 * @template T
700 */
701function calcRecursive(prop, inputs) {
702 const {compute, recursive} = prop;
703 if (typeof recursive == 'function') {
704 return inputs ? recursive(inputs) : true;
705 }
706 if (recursive && inputs && !compute) {
707 // The default `compute` function is to pick the input value when available
708 // and to fallback to the parent. Thus, when inputs are specified,
709 // there's no longer a need for the parent.
710 return false;
711 }
712 return recursive;
713}
714
715/**
716 * A substitute for `compute(...deps)`, but faster.

Callers 1

calc_Method · 0.85

Calls 1

recursiveFunction · 0.85

Tested by

no test coverage detected