From effa9de53ffc33dbeeee2a7cfc238b646b107f47 Mon Sep 17 00:00:00 2001 From: Evan Seguin Date: Thu, 7 May 2015 11:49:41 -0700 Subject: [PATCH] Adding type checks to prevent errors resulting from assuming two object properties are of the same type --- src/utils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index 41d6368..dd17503 100644 --- a/src/utils.js +++ b/src/utils.js @@ -27,9 +27,11 @@ module.exports = { }, isSame: function (a, b) { - if (Array.isArray(a)) { + if (typeof a !== typeof b) { + return false; + } else if (Array.isArray(a)) { return !this.arraysDiffer(a, b); - } else if (typeof a === 'object' && a !== null && a !== undefined) { + } else if (typeof a === 'object' && a !== null) { return !this.objectsDiffer(a, b); }