Make _.defaultTo return the defaultValue for NaN and nullish values.

This commit is contained in:
John-David Dalton
2016-05-25 13:00:10 -07:00
parent 0964f9175e
commit 90f95306f9
2 changed files with 6 additions and 5 deletions

View File

@@ -4604,11 +4604,11 @@
QUnit.module('lodash.defaultTo');
(function() {
QUnit.test('should return a default value if `value` is `undefined`', function(assert) {
QUnit.test('should return a default value if `value` is `NaN` or nullish', function(assert) {
assert.expect(1);
var expected = lodashStable.map(falsey, function(value) {
return value === undefined ? 1 : value;
return (value == null || value !== value) ? 1 : value;
});
var actual = lodashStable.map(falsey, function(value) {