You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:51:25 UTC
[06/50] brooklyn-ui git commit: Formatting
Formatting
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/5ca51628
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/5ca51628
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/5ca51628
Branch: refs/heads/0.4.0
Commit: 5ca51628b414c3a7525dc025de4d8b37136140d2
Parents: c137b1a
Author: sjcorbett <sa...@cloudsoftcorp.com>
Authored: Sat Mar 31 16:29:58 2012 +0100
Committer: sjcorbett <sa...@cloudsoftcorp.com>
Committed: Mon Apr 2 10:31:05 2012 +0100
----------------------------------------------------------------------
.../web-app/js/console/util/brooklyn-util.js | 30 +++++++++-----------
1 file changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/5ca51628/usage/web-console/web-app/js/console/util/brooklyn-util.js
----------------------------------------------------------------------
diff --git a/usage/web-console/web-app/js/console/util/brooklyn-util.js b/usage/web-console/web-app/js/console/util/brooklyn-util.js
index d1dceec..1df6cb4 100644
--- a/usage/web-console/web-app/js/console/util/brooklyn-util.js
+++ b/usage/web-console/web-app/js/console/util/brooklyn-util.js
@@ -10,43 +10,39 @@ Brooklyn.util = (function(){
$(Brooklyn.eventBus).bind("update", tab.handler.update);
}
- function typeTest(a, b) {
- return (typeof a == typeof b)
- }
-
// Object equality test based on code in StackOverflow answer by Jean Vincent
// http://stackoverflow.com/a/6713782/41195
function testEquivalent(x, y) {
// if both x and y are null or undefined and exactly the same
- if ( x === y ) return true;
+ if (x === y) return true;
// if they are not strictly equal, they both need to be Objects
- if ( ! ( x instanceof Object ) || ! ( y instanceof Object ) ) return false;
+ if (!(x instanceof Object) || !(y instanceof Object)) return false;
// they must have the exact same prototype chain, the closest we can do is
// test there constructor.
- if ( x.constructor !== y.constructor ) return false;
+ if (x.constructor !== y.constructor) return false;
- for ( var p in x ) {
+ for (var p in x) {
// other properties were tested using x.constructor === y.constructor
- if ( ! x.hasOwnProperty( p ) ) continue;
+ if (!x.hasOwnProperty(p)) continue;
- // allows to compare x[ p ] and y[ p ] when set to undefined
- if ( ! y.hasOwnProperty( p ) ) return false;
+ // allows to compare x[p] and y[p] when set to undefined
+ if (!y.hasOwnProperty(p)) return false;
// if they have the same strict value or identity then they are equal
- if ( x[ p ] === y[ p ] ) continue;
+ if (x[p] === y[p]) continue;
// Numbers, Strings, Functions, Booleans must be strictly equal
- if ( typeof( x[ p ] ) !== "object" ) return false;
+ if (typeof(x[p]) !== "object") return false;
// Objects and Arrays must be tested recursively
- if ( ! testEquivalent2( x[ p ], y[ p ] ) ) return false;
+ if (!testEquivalent2(x[p], y[p])) return false;
}
- for ( p in y ) {
- // allows x[ p ] to be set to undefined
- if ( y.hasOwnProperty( p ) && ! x.hasOwnProperty( p ) ) return false;
+ for (p in y) {
+ // allows x[p] to be set to undefined
+ if (y.hasOwnProperty(p) && !x.hasOwnProperty(p)) return false;
}
return true;
}