* Whether the parent value is required to calculate the used value. * * @param {IContextProp } prop * @param {T[]|undefined} inputs * @return {boolean} * @template T
(prop, inputs)
| 699 | * @template T |
| 700 | */ |
| 701 | function 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. |