* Resolves the objects from options and defaults for option value resolution. * @param {object} mainScope - The main scope object for options * @param {string[][]} keyLists - The arrays of keys in resolution order * @param {boolean} [resetCache] - reset the cache for this mainScope
(mainScope, keyLists, resetCache)
| 294 | * @param {boolean} [resetCache] - reset the cache for this mainScope |
| 295 | */ |
| 296 | getOptionScopes(mainScope, keyLists, resetCache) { |
| 297 | const {options, type} = this; |
| 298 | const cache = this._cachedScopes(mainScope, resetCache); |
| 299 | const cached = cache.get(keyLists); |
| 300 | if (cached) { |
| 301 | return cached; |
| 302 | } |
| 303 | |
| 304 | const scopes = new Set(); |
| 305 | |
| 306 | keyLists.forEach(keys => { |
| 307 | if (mainScope) { |
| 308 | scopes.add(mainScope); |
| 309 | keys.forEach(key => addIfFound(scopes, mainScope, key)); |
| 310 | } |
| 311 | keys.forEach(key => addIfFound(scopes, options, key)); |
| 312 | keys.forEach(key => addIfFound(scopes, overrides[type] || {}, key)); |
| 313 | keys.forEach(key => addIfFound(scopes, defaults, key)); |
| 314 | keys.forEach(key => addIfFound(scopes, descriptors, key)); |
| 315 | }); |
| 316 | |
| 317 | const array = Array.from(scopes); |
| 318 | if (array.length === 0) { |
| 319 | array.push(Object.create(null)); |
| 320 | } |
| 321 | if (keysCached.has(keyLists)) { |
| 322 | cache.set(keyLists, array); |
| 323 | } |
| 324 | return array; |
| 325 | } |
| 326 | |
| 327 | /** |
| 328 | * Returns the option scopes for resolving chart options |
no test coverage detected