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.

27 lines
529 B

import { Iterable } from './Iterable.ts'
import { collect } from './Collection.ts'
export class ArrayIterable<T> extends Iterable<T> {
constructor(
protected items: T[],
) {
super()
}
async at_index(i: number) {
return this.items[i]
}
async from_range(start: number, end: number) {
return collect(this.items.slice(start, end + 1))
}
async count() {
return this.items.length
}
clone() {
return new ArrayIterable([...this.items])
}
}