From 55f99e071047e86154fdbbe911445fb2112f7191 Mon Sep 17 00:00:00 2001 From: Efthymis Sarbanis Date: Sat, 28 Jun 2014 00:24:04 +0300 Subject: [PATCH] chore: use triple equals comparison with typeof operator. It is common practice for typeof operator to be used with '==='. Closes #8009 --- src/Angular.js | 2 +- src/auto/injector.js | 2 +- src/ng/controller.js | 2 +- src/ng/filter/filter.js | 2 +- src/ng/rootScope.js | 2 +- src/ngScenario/Scenario.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 5916174504b3..3d2553e0b8ab 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1409,7 +1409,7 @@ function assertArgFn(arg, name, acceptArrayAnnotation) { } assertArg(isFunction(arg), name, 'not a function, got ' + - (arg && typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg)); + (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg)); return arg; } diff --git a/src/auto/injector.js b/src/auto/injector.js index 75e377a56142..7d0f7e61ba42 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -72,7 +72,7 @@ function annotate(fn) { argDecl, last; - if (typeof fn == 'function') { + if (typeof fn === 'function') { if (!($inject = fn.$inject)) { $inject = []; if (fn.length) { diff --git a/src/ng/controller.js b/src/ng/controller.js index d3d1563308cc..697bc83d8747 100644 --- a/src/ng/controller.js +++ b/src/ng/controller.js @@ -74,7 +74,7 @@ function $ControllerProvider() { instance = $injector.instantiate(expression, locals); if (identifier) { - if (!(locals && typeof locals.$scope == 'object')) { + if (!(locals && typeof locals.$scope === 'object')) { throw minErr('$controller')('noscp', "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.", constructor || expression.name, identifier); diff --git a/src/ng/filter/filter.js b/src/ng/filter/filter.js index e662392d8dbf..9f0afeaa68b0 100644 --- a/src/ng/filter/filter.js +++ b/src/ng/filter/filter.js @@ -195,7 +195,7 @@ function filterFilter() { // jshint +W086 for (var key in expression) { (function(path) { - if (typeof expression[path] == 'undefined') return; + if (typeof expression[path] === 'undefined') return; predicates.push(function(value) { return search(path == '$' ? value : (value && value[path]), expression[path]); }); diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index 6c5d6ca52a11..179983ca7cc0 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -639,7 +639,7 @@ function $RootScopeProvider(){ if ((value = watch.get(current)) !== (last = watch.last) && !(watch.eq ? equals(value, last) - : (typeof value == 'number' && typeof last == 'number' + : (typeof value === 'number' && typeof last === 'number' && isNaN(value) && isNaN(last)))) { dirty = true; lastDirtyWatch = watch; diff --git a/src/ngScenario/Scenario.js b/src/ngScenario/Scenario.js index f323e01d0f5a..cab6eb06a508 100644 --- a/src/ngScenario/Scenario.js +++ b/src/ngScenario/Scenario.js @@ -294,7 +294,7 @@ _jQuery.fn.bindings = function(windowJquery, bindExp) { function push(value) { if (value === undefined) { value = ''; - } else if (typeof value != 'string') { + } else if (typeof value !== 'string') { value = angular.toJson(value); } result.push('' + value);