Using iterables to walk over a large amount of items/data has two advantages:
- In contrast to computing a full array all items, items can be read from the tree on the fly. This prevents unnecessary graph walks.
- Iterables are well-supported within ECMAScript and libs:
String, Array, Map, Set etc. are iterable.
Examples of how iterables would be useful for this lib:
for (const key of tree.keys()) {
await userRequestedAKey()
console.log(key)
}
for (const node of tree.range('A', 'O')) {
console.log(node.data)
}
Using iterables to walk over a large amount of items/data has two advantages:
String,Array,Map,Setetc. are iterable.Examples of how iterables would be useful for this lib: