You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
730 B

import {AsyncCollection} from '../../../../../lib/src/collection/AsyncCollection.ts'
import {ResultIterable} from './ResultIterable.ts'
import {Collection} from "../../../../../lib/src/collection/Collection.ts";
export class ResultCollection extends AsyncCollection<any> {
constructor(
executable: ResultIterable,
chunk_size: number = 1000
) {
super(executable, chunk_size)
}
then(func?: (items: Collection<any>) => any) {
if ( func ) {
this.collect().then((items: Collection<any>) => func(items))
} else {
return new Promise(res => [
this.collect().then((items: Collection<any>) => res(items))
])
}
}
}