From 20d86b2a00adfc24540734bdfb1c285d6e4bae98 Mon Sep 17 00:00:00 2001 From: Zaven Muradyan Date: Sun, 15 Oct 2017 12:27:45 -0700 Subject: [PATCH] Fix lint warning in CallTracker. The previous code was using `== null` to handle both `null` and `undefined`, resulting in a jshint warning. The conditional is meant to check for non-primitive values, and it happens to be the case that a falsey value in JS is always a primitive, or `null` or `undefined`. --- src/core/CallTracker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/CallTracker.js b/src/core/CallTracker.js index f7ae4013..e77fa909 100644 --- a/src/core/CallTracker.js +++ b/src/core/CallTracker.js @@ -14,7 +14,8 @@ getJasmineRequireObj().CallTracker = function(j$) { var str = Object.prototype.toString.apply(argsAsArray[i]), primitives = /^\[object (Boolean|String|RegExp|Number)/; - if (argsAsArray[i] == null || str.match(primitives)) { + // All falsey values are either primitives, `null`, or `undefined. + if (!argsAsArray[i] || str.match(primitives)) { clonedArgs.push(argsAsArray[i]); } else { clonedArgs.push(j$.util.clone(argsAsArray[i]));