(inputs: Array<unknown>, context?: object, index?: number, info?: { cacheable: boolean })
| 152 | * @since 2.7.0 |
| 153 | */ |
| 154 | export 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 |
no test coverage detected