diff --git a/lodash.src.js b/lodash.src.js index 483e299f4..b89ca643a 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -2326,7 +2326,7 @@ } } var objIsObj = (objTag == objectTag || (isLoose && objTag == funcTag)) && !isHostObject(object), - othIsObj = othTag == objectTag && !isHostObject(other), + othIsObj = (othTag == objectTag || (isLoose && othTag == funcTag)) && !isHostObject(other), isSameTag = objTag == othTag; if (isSameTag && !(objIsArr || objIsObj)) { diff --git a/test/test.js b/test/test.js index 5c2f08b24..81378a6a1 100644 --- a/test/test.js +++ b/test/test.js @@ -9494,6 +9494,16 @@ strictEqual(matches(object), true); }); + test('should match properties when `value` is a function', 1, function() { + function Foo() {} + Foo.a = function() {}; + Foo.a.b = 1; + Foo.a.c = 2; + + var matches = _.matches({ 'a': { 'b': 1 } }); + strictEqual(matches(Foo), true); + }); + test('should match properties when `value` is not a plain object', 1, function() { function Foo(object) { _.assign(this, object); } @@ -9672,6 +9682,16 @@ strictEqual(matches(object), true); }); + test('should match properties when `value` is a function', 1, function() { + function Foo() {} + Foo.a = function() {}; + Foo.a.b = 1; + Foo.a.c = 2; + + var matches = _.matchesProperty('a', { 'b': 1 }); + strictEqual(matches(Foo), true); + }); + test('should match properties when `value` is not a plain object', 1, function() { function Foo(object) { _.assign(this, object); }