Loading...
const all = Array.from(rows.values());
const page = all.slice(20, 30);const page = rows.values()
.drop(20)
.take(10)
.toArray();drop() and take() skip and limit lazily, so only the needed rows are read instead of copying all of them first.
drop() to run right away, while it is lazy until the iterator is consumed.drop() throws a RangeError.drop() is chained with take() for paging instead of converting to an array first.slice()?Chain drop(start) and take(count). For example, it.drop(5).take(5) yields the sixth to tenth values.
drop() throw if the count is larger than the iterator?No. It skips everything, and the resulting iterator finishes with no values.