mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Cleanup support for a step of 0 in _.range and add unit tests.
Former-commit-id: 383719999d8f4a7e153784aea3b6f4174684dd9a
This commit is contained in:
@@ -4682,12 +4682,15 @@
|
||||
* _.range(0, -10, -1);
|
||||
* // => [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
|
||||
*
|
||||
* _.range(1, 4, 0);
|
||||
* // => [1, 1, 1]
|
||||
*
|
||||
* _.range(0);
|
||||
* // => []
|
||||
*/
|
||||
function range(start, end, step) {
|
||||
start = +start || 0;
|
||||
step = isNumber(step) ? step : 1;
|
||||
step = typeof step == 'number' ? step : 1;
|
||||
|
||||
if (end == null) {
|
||||
end = start;
|
||||
|
||||
Reference in New Issue
Block a user