Releases: nvie/itertools
Releases · nvie/itertools
v2.4.0
- Add second param
index
to all predicates. This will make operations like partitioning a list based on the element position as easy as partitioning based on the element value, for example:const items = [1, 2, 3, 4, 5, 6, 7, 8, 9]; const [thirds, rest] = partition(items, (item, index) => index % 3 === 0); console.log(thirds); // [1, 4, 7] console.log(rest); // [2, 3, 5, 6, 8, 9]
- Officially drop Node 16 support (it may still work)
v2.3.2
v2.3.1
v2.3.0
v2.2.5
v2.2.4
v2.2.3
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! 🙏
v2.2.2
- Fix
reduce()
bug where using it on a lazy iterable would produce the wrong result (thanks for finding, @quangloc99 🙏!)
v2.2.1
- Fix
islice()
regression where it wasn't stopping on infinite iterables (thanks for finding, @Kareem-Medhat 🙏!)