Преглед изворни кода

EAGLESIX-2653: ExistsMatchExpression formatting fixes

Chris Sexton пре 11 година
родитељ
комит
ea61e5ced9

+ 4 - 9
lib/pipeline/matcher/ExistsMatchExpression.js

@@ -1,7 +1,7 @@
 "use strict";
 var LeafMatchExpression = require('./LeafMatchExpression');
 
-// Autogenerated by cport.py on 2013-09-17 14:37
+// File: expression_leaf.cpp
 var ExistsMatchExpression = module.exports = function ExistsMatchExpression(){
 	base.call(this);
 	this._matchType = 'EXISTS';
@@ -15,7 +15,6 @@ var ExistsMatchExpression = module.exports = function ExistsMatchExpression(){
  *
  */
 proto.debugString = function debugString(level) {
-	// File: expression_leaf.cpp lines: 286-294
 	return this._debugAddSpace( level ) + this.path() + " exists" + (this.getTag() ? " " + this.getTag().debugString() : "") + "\n";
 };
 
@@ -27,8 +26,7 @@ proto.debugString = function debugString(level) {
  *
  */
 proto.equivalent = function equivalent(other) {
-	// File: expression_leaf.cpp lines: 297-302
-	if(this._matchType != other._matchType)	{
+	if(this._matchType !== other._matchType) {
 		return false;
 	}
 	return this.path() == other.path();
@@ -43,7 +41,6 @@ proto.equivalent = function equivalent(other) {
  *
  */
 proto.init = function init(path) {
-	// File: expression_leaf.cpp lines: 278-279
 	return this.initPath( path );
 };
 
@@ -55,12 +52,11 @@ proto.init = function init(path) {
  *
  */
 proto.matchesSingleElement = function matchesSingleElement(e) {
-	// File: expression_leaf.cpp lines: 282-283
-	if(typeof(e) == 'undefined')
+	if(typeof(e) === 'undefined')
 		return false;
 	if(e === null)
 		return true;
-	if(typeof(e) == 'object')
+	if(typeof(e) === 'object')
 		return (Object.keys(e).length > 0);
 	else
 		return true;
@@ -73,7 +69,6 @@ proto.matchesSingleElement = function matchesSingleElement(e) {
  *
  */
 proto.shallowClone = function shallowClone(){
-	// File: expression_leaf.h lines: 220-223
 	var e = new ExistsMatchExpression();
 	e.init(this.path());
 	return e;

+ 7 - 7
test/lib/pipeline/matcher/ExistsMatchExpression.js

@@ -9,16 +9,16 @@ module.exports = {
 		"should match an element": function (){
 			var e = new ExistsMatchExpression();
 			var s = e.init('a');
-			
+
 			assert.strictEqual(s.code, 'OK');
 			assert.ok( e.matches({'a':5}) );
 			assert.ok( e.matches({'a':null}) );
-			assert.ok( ! e.matches({'a':{}}) );	
+			assert.ok( ! e.matches({'a':{}}) );
 		},
 		"should match a boolean":function() {
 			var e = new ExistsMatchExpression();
 			var s = e.init('a');
-			
+
 			assert.strictEqual( s.code, 'OK' );
 			assert.ok( e.matches({'a':5}) );
 			assert.ok( ! e.matches({}) );
@@ -27,7 +27,7 @@ module.exports = {
 		"should match a number":function() {
 			var e = new ExistsMatchExpression();
 			var s = e.init('a');
-			
+
 			assert.strictEqual( s.code, 'OK' );
 			assert.ok( e.matches({'a':1}) );
 			assert.ok( e.matches({'a':null}) );
@@ -36,9 +36,9 @@ module.exports = {
 		"should match an array":function() {
 			var e = new ExistsMatchExpression();
 			var s = e.init('a');
-			
+
 			assert.strictEqual( s.code, 'OK' );
-			assert.ok( e.matches({'a':[4,5.5]}) );	
+			assert.ok( e.matches({'a':[4,5.5]}) );
 		},
 		"should yield an elemMatchKey":function() {
 			var e = new ExistsMatchExpression();
@@ -49,7 +49,7 @@ module.exports = {
 
 			assert.ok( ! e.matches({'a':1}, m) );
 			assert.ok( ! m.hasElemMatchKey() );
-			
+
 			assert.ok( e.matches({'a':{'b':6}}));
 			assert.ok( ! m.hasElemMatchKey() );