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 { constructor( executable: ResultIterable, chunk_size: number = 1000 ) { super(executable, chunk_size) } then(func?: (items: Collection) => any) { if ( func ) { this.collect().then((items: Collection) => func(items)) } else { return new Promise(res => [ this.collect().then((items: Collection) => res(items)) ]) } } }