|
|
|
@ -401,7 +401,17 @@ export class AsyncCollection<T> {
|
|
|
|
|
let newItems: CollectionItem<T>[] = []
|
|
|
|
|
|
|
|
|
|
await this.inChunks(async items => {
|
|
|
|
|
newItems = newItems.concat(items.filter(func).all())
|
|
|
|
|
const filterItems: CollectionItem<T>[] = []
|
|
|
|
|
|
|
|
|
|
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<T>(newItems)
|
|
|
|
|