Finish fleshing out Model; refactor mixin types; TRUNCATE
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user