( prop: string, value: unknown[], target: ContextCache, isIndexable: (key: string) => boolean )
| 273 | } |
| 274 | |
| 275 | function _resolveArray( |
| 276 | prop: string, |
| 277 | value: unknown[], |
| 278 | target: ContextCache, |
| 279 | isIndexable: (key: string) => boolean |
| 280 | ) { |
| 281 | const {_proxy, _context, _subProxy, _descriptors: descriptors} = target; |
| 282 | |
| 283 | if (typeof _context.index !== 'undefined' && isIndexable(prop)) { |
| 284 | return value[_context.index % value.length]; |
| 285 | } else if (isObject(value[0])) { |
| 286 | // Array of objects, return array or resolvers |
| 287 | const arr = value; |
| 288 | const scopes = _proxy._scopes.filter(s => s !== arr); |
| 289 | value = []; |
| 290 | for (const item of arr) { |
| 291 | const resolver = createSubResolver(scopes, _proxy, prop, item); |
| 292 | value.push(_attachContext(resolver, _context, _subProxy && _subProxy[prop], descriptors)); |
| 293 | } |
| 294 | } |
| 295 | return value; |
| 296 | } |
| 297 | |
| 298 | function resolveFallback( |
| 299 | fallback: ResolverObjectKey | ((prop: ResolverObjectKey, value: unknown) => ResolverObjectKey), |
no test coverage detected