Finish fleshing out Model; refactor mixin types; TRUNCATE

This commit is contained in:
garrettmills
2020-07-19 14:13:48 -05:00
parent e4f5da7ac6
commit b915fcedf9
30 changed files with 832 additions and 131 deletions

View File

@@ -496,7 +496,9 @@ export class AsyncCollection<T> {
if ( !fetched_indices.includes(index) ) {
fetched_indices.push(index)
random_items.push(await this._items.at_index(index))
const item = await this._items.at_index(index)
if ( typeof item !== 'undefined' )
random_items.push(item)
}
}

View File

@@ -8,7 +8,7 @@ export class StopIteration extends Error {}
export abstract class Iterable<T> {
protected index = 0
abstract async at_index(i: number): Promise<T>
abstract async at_index(i: number): Promise<T | undefined>
abstract async from_range(start: number, end: number): Promise<Collection<T>>
abstract async count(): Promise<number>
abstract clone(): Iterable<T>