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

Function resolve

src/helpers/helpers.options.ts:154–178  ·  view source on GitHub ↗
(inputs: Array<unknown>, context?: object, index?: number, info?: { cacheable: boolean })

Source from the content-addressed store, hash-verified

152 * @since 2.7.0
153 */
154export function resolve(inputs: Array<unknown>, context?: object, index?: number, info?: { cacheable: boolean }) {
155 let cacheable = true;
156 let i: number, ilen: number, value: unknown;
157
158 for (i = 0, ilen = inputs.length; i < ilen; ++i) {
159 value = inputs[i];
160 if (value === undefined) {
161 continue;
162 }
163 if (context !== undefined && typeof value === 'function') {
164 value = value(context);
165 cacheable = false;
166 }
167 if (index !== undefined && isArray(value)) {
168 value = value[index % value.length];
169 cacheable = false;
170 }
171 if (value !== undefined) {
172 if (info && !cacheable) {
173 info.cacheable = false;
174 }
175 return value;
176 }
177 }
178}
179
180/**
181 * @param minmax

Calls 2

valueFunction · 0.85
isArrayFunction · 0.85

Tested by

no test coverage detected