From b195fdbf60a6b549515b3e8ca6be05b65bde9cb5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 13 Jun 2014 23:52:57 -0700 Subject: [PATCH] Optimize `_.matches`. --- lodash.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index f82ce21c3..704962016 100644 --- a/lodash.js +++ b/lodash.js @@ -8207,12 +8207,12 @@ // property containing a primitive value if (propsLength == 1 && value === value && !isObject(value)) { return function(object) { - if (!(object && hasOwnProperty.call(object, key))) { + if (object == null) { return false; } // treat `-0` vs. `+0` as not equal var other = object[key]; - return value === other && (value !== 0 || (1 / value == 1 / other)); + return value === other && (value !== 0 || (1 / value == 1 / other)) && hasOwnProperty.call(object, key); }; } return function(object) {