diff --git a/lodash.js b/lodash.js index 799df4b94..69cf59b73 100644 --- a/lodash.js +++ b/lodash.js @@ -12455,9 +12455,12 @@ if (step && isIterateeCall(start, end, step)) { end = step = undefined; } - start = +start || 0; + start = +start; step = step === undefined ? 1 : (+step || 0); + if (start !== start) { + start = 0; + } if (end === undefined) { end = start; start = 0; diff --git a/test/test.js b/test/test.js index 0c0ded3d9..18f51de13 100644 --- a/test/test.js +++ b/test/test.js @@ -14911,6 +14911,13 @@ assert.deepEqual(_.range(21, 10, -3), [21, 18, 15, 12]); }); + QUnit.test('should not coerce `start` of `-0` to `0`', function(assert) { + assert.expect(1); + + var actual = _.range(-0, 1); + assert.strictEqual(1 / actual[0], -Infinity); + }); + QUnit.test('should treat falsey `start` arguments as `0`', function(assert) { assert.expect(13);