Describe the bug
Passing a positive start and stopping with a negative step into range will produce an infinite loop.
expect behavior:
it('should return an empty array when step is negative', () => {
const start = 1;
const stop = 5;
const step = -1;
const result = range(start, stop, step);
expect(result).toEqual([]);
})
Reproduction
Please refer to the unit test below.
System Info
System:
OS: Windows 11 10.0.22631
CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400F @ 2.60GHz
Memory: 24.88 GB / 31.88 GB
Binaries:
Node: 20.16.0 - D:\env\nodejs\node.EXE
npm: 10.8.1 - D:\env\nodejs\npm.CMD
pnpm: 9.12.2 - ~\AppData\Roaming\npm\pnpm.CMD
Browsers:
Edge: Chromium (127.0.2651.74)
Internet Explorer: 11.0.22621.3527
Used Package Manager
npm
Validations
Contributions
Describe the bug
Passing a positive start and stopping with a negative step into
rangewill produce an infinite loop.expect behavior:
Reproduction
Please refer to the unit test below.
System Info
Used Package Manager
npm
Validations
Contributions