feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -38,6 +38,7 @@ class MultiItemCache {
*/
constructor(items) {
this._items = items;
// eslint-disable-next-line no-constructor-return
if (items.length === 1) return /** @type {any} */ (items[0]);
}
@@ -59,12 +60,11 @@ class MultiItemCache {
* @param {number} i index
* @returns {Promise<T>} promise with the data
*/
const next = i => {
return this._items[i].getPromise().then(result => {
const next = i =>
this._items[i].getPromise().then(result => {
if (result !== undefined) return result;
if (++i < this._items.length) return next(i);
});
};
return next(0);
}