mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 19:40:56 +08:00
chore: use triple equals comparison with typeof operator.
It is common practice for typeof operator to be used with '==='. Closes #8009
This commit is contained in:
committed by
Igor Minar
parent
1a99ca9c08
commit
55f99e0710
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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]);
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user