diff --git a/package.json b/package.json index 58d28c9..468a249 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@extollo/lib", - "version": "0.9.40", + "version": "0.9.41", "description": "The framework library that lifts up your code.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/util/collection/AsyncCollection.ts b/src/util/collection/AsyncCollection.ts index 0accd4d..3be9462 100644 --- a/src/util/collection/AsyncCollection.ts +++ b/src/util/collection/AsyncCollection.ts @@ -401,7 +401,17 @@ export class AsyncCollection { let newItems: CollectionItem[] = [] await this.inChunks(async items => { - newItems = newItems.concat(items.filter(func).all()) + const filterItems: CollectionItem[] = [] + + for ( let i = 0; i < items.length; i += 1 ) { + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const item = items.get(i)! + if ( await func(item, i) ) { + filterItems.push(item) + } + } + + newItems = newItems.concat(filterItems) }) return new Collection(newItems)