diff --git a/index.html b/index.html index 5222f69fa..217aa08ba 100644 --- a/index.html +++ b/index.html @@ -2428,7 +2428,7 @@

Change Log

_.extend only iterates over the object's own properties.
  • - Falsey guards are no longer needed in _.extend and + Falsy guards are no longer needed in _.extend and _.defaults—if the passed in argument isn't a JavaScript object it's just returned.
  • diff --git a/test/arrays.js b/test/arrays.js index 023734601..47b1bacdf 100644 --- a/test/arrays.js +++ b/test/arrays.js @@ -167,7 +167,7 @@ assert.deepEqual(_.uniq(list, true, iterator), expected, 'uses the result of `iterator` for uniqueness comparisons (sorted case)'); assert.deepEqual(_.uniq(list, true, 'score'), expected, 'when `iterator` is a string, uses that key for comparisons (sorted case)'); - assert.deepEqual(_.uniq([{0: 1}, {0: 1}, {0: 1}, {0: 2}], 0), [{0: 1}, {0: 2}], 'can use falsey pluck like iterator'); + assert.deepEqual(_.uniq([{0: 1}, {0: 1}, {0: 1}, {0: 2}], 0), [{0: 1}, {0: 2}], 'can use falsy pluck like iterator'); var result = (function(){ return _.uniq(arguments); }(1, 2, 1, 3, 1, 4)); assert.deepEqual(result, [1, 2, 3, 4], 'works on an arguments object'); @@ -370,7 +370,7 @@ QUnit.test('lastIndexOf', function(assert) { var numbers = [1, 0, 1]; - var falsey = [void 0, '', 0, false, NaN, null, void 0]; + var falsy = [void 0, '', 0, false, NaN, null, void 0]; assert.strictEqual(_.lastIndexOf(numbers, 1), 2); numbers = [1, 0, 1, 0, 0, 1, 0, 0, 0]; @@ -406,15 +406,15 @@ assert.strictEqual(_.lastIndexOf(array, '', fromIndex), -1); }); - var expected = _.map(falsey, function(value) { + var expected = _.map(falsy, function(value) { return typeof value == 'number' ? -1 : 5; }); - var actual = _.map(falsey, function(fromIndex) { + var actual = _.map(falsy, function(fromIndex) { return _.lastIndexOf(array, 3, fromIndex); }); - assert.deepEqual(actual, expected, 'should treat falsey `fromIndex` values, except `0` and `NaN`, as `array.length`'); + assert.deepEqual(actual, expected, 'should treat falsy `fromIndex` values, except `0` and `NaN`, as `array.length`'); assert.strictEqual(_.lastIndexOf(array, 3, '1'), 5, 'should treat non-number `fromIndex` values as `array.length`'); assert.strictEqual(_.lastIndexOf(array, 3, true), 5, 'should treat non-number `fromIndex` values as `array.length`'); diff --git a/test/objects.js b/test/objects.js index ac27186a6..e2ebcda52 100644 --- a/test/objects.js +++ b/test/objects.js @@ -922,7 +922,7 @@ // Deep property access assert.strictEqual(_.property('a')({a: 1}), 1, 'can get a direct property'); assert.strictEqual(_.property(['a', 'b'])({a: {b: 2}}), 2, 'can get a nested property'); - assert.strictEqual(_.property(['a'])({a: false}), false, 'can fetch falsey values'); + assert.strictEqual(_.property(['a'])({a: false}), false, 'can fetch falsy values'); assert.strictEqual(_.property(['x', 'y'])({x: {y: null}}), null, 'can fetch null values deeply'); assert.strictEqual(_.property(['x', 'y'])({x: null}), void 0, 'does not crash on property access of nested non-objects'); assert.strictEqual(_.property([])({x: 'y'}), void 0, 'returns `undefined` for a path that is an empty array'); @@ -988,7 +988,7 @@ //null edge cases var oCon = {constructor: Object}; - assert.deepEqual(_.map([null, void 0, 5, {}], _.partial(_.isMatch, _, oCon)), [false, false, false, true], 'doesnt falsey match constructor on undefined/null'); + assert.deepEqual(_.map([null, void 0, 5, {}], _.partial(_.isMatch, _, oCon)), [false, false, false, true], 'doesnt falsy match constructor on undefined/null'); }); QUnit.test('matcher', function(assert) { @@ -1045,7 +1045,7 @@ //null edge cases var oCon = _.matcher({constructor: Object}); - assert.deepEqual(_.map([null, void 0, 5, {}], oCon), [false, false, false, true], 'doesnt falsey match constructor on undefined/null'); + assert.deepEqual(_.map([null, void 0, 5, {}], oCon), [false, false, false, true], 'doesnt falsy match constructor on undefined/null'); }); QUnit.test('matches', function(assert) { diff --git a/test/utility.js b/test/utility.js index 2c6095a9c..1fe3220e1 100644 --- a/test/utility.js +++ b/test/utility.js @@ -345,7 +345,7 @@ assert.strictEqual(_.result({a: 1}, 'b', 2), 2, 'uses the fallback value when property is missing'); assert.strictEqual(_.result({a: 1}, ['b', 'c'], 2), 2, 'uses the fallback value when any property is missing'); assert.strictEqual(_.result({a: void 0}, ['a'], 1), 1, 'uses the fallback when value is undefined'); - assert.strictEqual(_.result({a: false}, ['a'], 'foo'), false, 'can fetch falsey values'); + assert.strictEqual(_.result({a: false}, ['a'], 'foo'), false, 'can fetch falsy values'); assert.strictEqual(_.result({a: func}, 'a'), 'f', 'can get a direct method'); assert.strictEqual(_.result({a: {b: func}}, ['a', 'b']), 'f', 'can get a nested method');