Bug
There is a index out of range bug here:
|
for (let i = 0; i < sortedReleaseDates.length - 1; i++) { |
|
const until = sortedReleaseDates[i + 1].date; |
|
ranges.push([ |
|
sortedReleaseDates[i], |
|
{ |
|
...sortedReleaseDates[i + RANGE - 1], |
The for loop index goes all the way to
length - 2 (2nd last element) and we are accessing indices
i and
i + 1 in the loop.
This only works when
RANGE = 2.
When RANGE > 2 we will access indices i and i + RANGE - 1 which will end up outside the range of the array
because we are not changing the for loop end condition.
Example:
RANGE = 3
length = 4
for loop i goes to length - 2 = 4 - 2 = 2
i = 2
i + RANGE - 1 = i + 3 - 1 = i + 2 = 2 + 2 = 4
...sortedReleaseDates[4], // gives a index out of range exception
Fix
for (let i = 0; i < sortedReleaseDates.length - RANGE + 1; i++) {
Bug
There is a index out of range bug here:
github-release-notes/lib/src/Gren.js
Lines 1096 to 1101 in 8c5affc
The for loop index goes all the way to
length - 2(2nd last element) and we are accessing indicesiandi + 1in the loop.This only works when
RANGE = 2.When
RANGE > 2we will access indicesiandi + RANGE - 1which will end up outside the range of the arraybecause we are not changing the for loop end condition.
Example:
Fix