Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
chore: use triple equals comparison with typeof operator.
Browse files Browse the repository at this point in the history
It is common practice for typeof operator to be used with '==='.

Closes #8009
  • Loading branch information
esarbanis authored and IgorMinar committed Jun 27, 2014
1 parent 1a99ca9 commit 55f99e0
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/auto/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/ng/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/ng/filter/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
});
Expand Down
2 changes: 1 addition & 1 deletion src/ng/rootScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ngScenario/Scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 55f99e0

Please sign in to comment.