Browse Source

fixed some broken references to Alter. refs #965

http://source.rd.rcg.local/trac/eagle6/changeset/1269/Eagle6_SVN
Philip Murray 13 years ago
parent
commit
0c92dec382
3 changed files with 38 additions and 38 deletions
  1. 1 1
      index.js
  2. 6 6
      lib/munge.js
  3. 31 31
      test/lib/munge.js

+ 1 - 1
index.js

@@ -1 +1 @@
-module.exports = require("./alter");
+module.exports = require("./munge");

+ 6 - 6
lib/munge.js

@@ -1,8 +1,8 @@
 var su = require("stream-utils");
 
-var Alterer = (function(){
+var Munger = (function(){
 	// CONSTRUCTOR
-	var base = Object, proto, klass = function Alterer(ops){
+	var base = Object, proto, klass = function Munger(ops){
 		this.ops = typeof(ops) == "object" && typeof(ops.length) === "number" ? ops : Array.prototype.slice.call(arguments, 0);
 		this.opStreams = this.ops.map(function opCompiler(op, i){	//TODO: demote to local only?
 			if(typeof(op) !== "object")
@@ -52,9 +52,9 @@ console.debug("PIPELINE ENDING...");
 })();
 
 
-module.exports = function alter(ops, inputs) {
-	var alterer = new Alterer(ops);
+module.exports = function mung(ops, inputs) {
+	var munger = new Munger(ops);
 	if(inputs)
-		return alterer.execute(inputs);
-	return alterer.execute.bind(alterer);
+		return munger.execute(inputs);
+	return munger.execute.bind(munger);
 };

+ 31 - 31
test/lib/munge.js

@@ -1,22 +1,22 @@
 var jsext = require("jsext").install(),	//TODO: remove this...
     assert = require("assert"),
-	alter = require("../../");
+	munge = require("../../");
 
 module.exports = {
 
-	"alter": {
+	"munge": {
 
 		"should be able to use an empty pipeline (no-op)": function(){
 console.debug("");
 			var i = [1, 2, 3],
 				p = [],
 				e = [1, 2, 3],
-				alterer = alter(p),
-				a = alterer(i);
+				munger = munge(p),
+				a = munger(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(alterer(i)), JSON.stringify(e), "Reuse of alterer should yeild the same results!");
-			assert.equal(JSON.stringify(alter(p, i)), JSON.stringify(e), "Alternate use of alter should yeild the same results!");
+			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
+			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
 		},
 
 		"should be able to use a $skip operator": function(){
@@ -24,12 +24,12 @@ console.debug("");
 			var i = [{_id:0}, {_id:1}, {_id:2}, {_id:3}, {_id:4}, {_id:5}],
 				p = [{$skip:2}, {$skip:1}],	//testing w/ 2 ensures independent state variables
 				e = [{_id:3}, {_id:4}, {_id:5}],
-				alterer = alter(p),
-				a = alterer(i);
+				munger = munge(p),
+				a = munger(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(alterer(i)), JSON.stringify(e), "Reuse of alterer should yeild the same results!");
-			assert.equal(JSON.stringify(alter(p, i)), JSON.stringify(e), "Alternate use of alter should yeild the same results!");
+			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
+			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
 		},
 
 		"should be able to use a $limit operator": function(){
@@ -37,12 +37,12 @@ console.debug("");
 			var i = [{_id:0}, {_id:1}, {_id:2}, {_id:3}, {_id:4}, {_id:5}],
 				p = [{$limit:2}],
 				e = [{_id:0}, {_id:1}],
-				alterer = alter(p),
-				a = alterer(i);
+				munger = munge(p),
+				a = munger(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(alterer(i)), JSON.stringify(e), "Reuse of alterer should yeild the same results!");
-			assert.equal(JSON.stringify(alter(p, i)), JSON.stringify(e), "Alternate use of alter should yeild the same results!");
+			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
+			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
 		},
 
 		"should be able to use a $skip and then a $limit operator together in the same pipeline": function(){
@@ -50,12 +50,12 @@ console.debug("");
 			var i = [{_id:0, e:1}, {_id:1, e:0}, {_id:2, e:1}, {_id:3, e:0}, {_id:4, e:1}, {_id:5, e:0}],
 				p = [{$skip:2}, {$limit:1}],
 				e = [{_id:2, e:1}],
-				alterer = alter(p),
-				a = alterer(i);
+				munger = munge(p),
+				a = munger(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(alterer(i)), JSON.stringify(e), "Reuse of alterer should yeild the same results!");
-			assert.equal(JSON.stringify(alter(p, i)), JSON.stringify(e), "Alternate use of alter should yeild the same results!");
+			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
+			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
 		},
 
 		"should be able to use a $match operator": function(){
@@ -63,12 +63,12 @@ console.debug("");
 			var i = [{_id:0, e:1}, {_id:1, e:0}, {_id:2, e:1}, {_id:3, e:0}, {_id:4, e:1}, {_id:5, e:0}],
 				p = [{$match:{e:1}}],
 				e = [{_id:0, e:1}, {_id:2, e:1}, {_id:4, e:1}],
-				alterer = alter(p),
-				a = alterer(i);
+				munger = munge(p),
+				a = munger(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(alterer(i)), JSON.stringify(e), "Reuse of alterer should yeild the same results!");
-			assert.equal(JSON.stringify(alter(p, i)), JSON.stringify(e), "Alternate use of alter should yeild the same results!");
+			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
+			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
 		},
 
 		"should be able to use a $project operator": function(){
@@ -76,12 +76,12 @@ console.debug("");
 			var i = [{_id:0, e:1}, {_id:1, e:0}, {_id:2, e:1}, {_id:3, e:0}, {_id:4, e:1}, {_id:5, e:0}],
 				p = [{$project:{e:1}}],
 				e = [{_id:0, e:1}, {_id:2, e:1}, {_id:4, e:1}],
-				alterer = alter(p),
-				a = alterer(i);
+				munger = munge(p),
+				a = munger(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(alterer(i)), JSON.stringify(e), "Reuse of alterer should yeild the same results!");
-			assert.equal(JSON.stringify(alter(p, i)), JSON.stringify(e), "Alternate use of alter should yeild the same results!");
+			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
+			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
 		},
 
 //TODO: $project w/ expressions
@@ -106,12 +106,12 @@ console.debug("");
 					{_id:0,nodes:{one:[1,1],two:22}},
 					{_id:1,nodes:{two:22,three:[333]}}
 				],
-				alterer = alter(p),
-				a = alterer(i);
+				munger = munge(p),
+				a = munger(i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			assert.deepEqual(a, e, "Unexpected value (not deepEqual)!");
-			assert.equal(JSON.stringify(alterer(i)), JSON.stringify(e), "Reuse of alterer should yeild the same results!");
-			assert.equal(JSON.stringify(alter(p, i)), JSON.stringify(e), "Alternate use of alter should yeild the same results!");
+			assert.equal(JSON.stringify(munger(i)), JSON.stringify(e), "Reuse of munger should yield the same results!");
+			assert.equal(JSON.stringify(munge(p, i)), JSON.stringify(e), "Alternate use of munge should yield the same results!");
 		},
 
 		"should be able to construct an instance with $sort operators properly (ascending)": function(){
@@ -134,7 +134,7 @@ console.debug("");
 					];
 			console.debug("\nINPUTS:\n", i);
 			console.debug("\nPIPELINE OPS:\n", p);
-			var a = alter(p, i);
+			var a = munge(p, i);
 			assert.equal(JSON.stringify(a), JSON.stringify(e), "Unexpected value!");
 			console.debug("\n");
 		}