mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Add _.toInteger tests.
This commit is contained in:
@@ -8890,8 +8890,8 @@
|
|||||||
* _.toInteger(NaN);
|
* _.toInteger(NaN);
|
||||||
* // => 0
|
* // => 0
|
||||||
*
|
*
|
||||||
* _.toInteger(Infinity);
|
* _.toInteger(-Infinity);
|
||||||
* // => Infinity
|
* // => -Infinity
|
||||||
*/
|
*/
|
||||||
function toInteger(value) {
|
function toInteger(value) {
|
||||||
return nativeFloor(value) || 0;
|
return nativeFloor(value) || 0;
|
||||||
|
|||||||
13
test/test.js
13
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');
|
QUnit.module('lodash.toPlainObject');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user