Skip to content

v2.2.3

Compare
Choose a tag to compare
@nvie nvie released this 09 Jan 16:35
· 32 commits to main since this release

Fixes a bug where some iterators would render an inputted generator unusable, causing it to no longer be consumable after the iterable returns.

Example:

function* gen() {
  yield 1;
  yield 2;
  yield 3;
  yield 4;
}

const lazy = gen();

// [1, 2]
Array.from(islice(lazy, 0, 2));

Array.from(lazy);
// ❌ Previously:    []
// ✅ Now correctly: [3, 4]

This bug only happened when the source was a generator. It did not happen on a normal iterable.

Similar bugs were present in:

  • find()
  • islice()
  • takewhile()
  • dropwhile()

No other iterables were affected by this bug. This is the same bug that was fixed in 2.2.2 for reduce(), so many thanks again for surfacing this edge case, @quangloc99! 🙏