Cloning not inheriting autoStart: false
rubensworks opened this issue · 0 comments
rubensworks commented
When a lazy (empty) iterator is cloned, it seems to consume the iterator eagerly, which makes it so that 'end'
events can be lost.
Minimal reproducible example:
const arrayIt = new ArrayIterator([], { autoStart: false });
const clonedIt = arrayIt.clone();
await new Promise((resolve) => setImmediate(resolve));
// The listeners below are never called
clonedIt.on('data', () => console.log('DATA'));
clonedIt.on('end', () => console.log('ENDED'));