mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Update lodash underscore build _.findWhere to follow v1.4.4 null behavior.
Former-commit-id: 7b6ce7e9d7cf032171f43835bbf907cf3ffeb908
This commit is contained in:
2
vendor/underscore/test/utility.js
vendored
2
vendor/underscore/test/utility.js
vendored
@@ -207,7 +207,7 @@ $(document).ready(function() {
|
||||
strictEqual(_.result(obj, 'x'), 'x');
|
||||
strictEqual(_.result(obj, 'y'), 'x');
|
||||
strictEqual(_.result(obj, 'z'), undefined);
|
||||
strictEqual(_.result(null, 'x'), undefined);
|
||||
strictEqual(_.result(null, 'x'), null);
|
||||
});
|
||||
|
||||
test('_.templateSettings.variable', function() {
|
||||
|
||||
4
vendor/underscore/underscore.js
vendored
4
vendor/underscore/underscore.js
vendored
@@ -238,7 +238,7 @@
|
||||
// Convenience version of a common use case of `filter`: selecting only objects
|
||||
// containing specific `key:value` pairs.
|
||||
_.where = function(obj, attrs, first) {
|
||||
if (_.isEmpty(attrs)) return first ? void 0 : [];
|
||||
if (_.isEmpty(attrs)) return first ? null : [];
|
||||
return _[first ? 'find' : 'filter'](obj, function(value) {
|
||||
for (var key in attrs) {
|
||||
if (attrs[key] !== value[key]) return false;
|
||||
@@ -1058,7 +1058,7 @@
|
||||
// If the value of the named property is a function then invoke it;
|
||||
// otherwise, return it.
|
||||
_.result = function(object, property) {
|
||||
if (object == null) return void 0;
|
||||
if (object == null) return null;
|
||||
var value = object[property];
|
||||
return _.isFunction(value) ? value.call(object) : value;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user