diff --git a/lodash.js b/lodash.js index 263cef5b4..c876d6a6a 100644 --- a/lodash.js +++ b/lodash.js @@ -8890,8 +8890,8 @@ * _.toInteger(NaN); * // => 0 * - * _.toInteger(Infinity); - * // => Infinity + * _.toInteger(-Infinity); + * // => -Infinity */ function toInteger(value) { return nativeFloor(value) || 0; diff --git a/test/test.js b/test/test.js index 783ff4054..44e162af9 100644 --- a/test/test.js +++ b/test/test.js @@ -15632,6 +15632,19 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.toInteger'); + + (function() { + test('should convert values to integers', 4, function() { + strictEqual(_.toInteger('3.14'), 3); + strictEqual(_.toInteger(), 0); + strictEqual(_.toInteger(NaN), 0); + strictEqual(_.toInteger(-Infinity), -Infinity); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.toPlainObject'); (function() {