Initial implementation for generating thread JSON files
This commit is contained in:
@@ -78,8 +78,11 @@ export abstract class Iterable<T> {
|
||||
throw new Error('Chunk size must be at least 1')
|
||||
}
|
||||
|
||||
const total = await this.count()
|
||||
while ( true ) {
|
||||
const items = await this.range(this.index, this.index + size - 1)
|
||||
// Bound the RHS index by the max # of items in case the source
|
||||
// doesn't gracefully handle out-of-bounds access
|
||||
const items = await this.range(this.index, Math.min(this.index + size - 1, total - 1))
|
||||
this.index += items.count()
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user