Ver código fonte

Merge branch 'release/v0.6.5+2014.01.13'

* release/v0.6.5+2014.01.13:
  Refs #4915: fix bad and unnecessary manipulation in Cursor
  Refs #4900. Updated async to IE10 compatible version.
  Refs #4573: update package.json to use release branch for version v0.6.5+2014.01.13.
  Refs #4561: update package.json to new version 0.6.5+2014.01.13.

Conflicts:
	package.json
Thomas Bell 11 anos atrás
pai
commit
816d72ae09
2 arquivos alterados com 9 adições e 7 exclusões
  1. 6 4
      lib/Cursor.js
  2. 3 3
      package.json

+ 6 - 4
lib/Cursor.js

@@ -6,19 +6,21 @@
  **/
 var klass = module.exports = function Cursor(items){
 	if (!(items instanceof Array)) throw new Error("arg `items` must be an Array");
-	this.cachedData = items.slice(0);	// keep a copy
+	this.cachedData = items.slice(0);	// keep a copy so array changes when using async doc srcs do not cause side effects
+	this.length = items.length;
+	this.offset = 0;
 }, base = Object, proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
 
 proto.ok = function ok(){
-	return this.cachedData.length > 0 || this.hasOwnProperty("curr");
+	return (this.offset < this.length) || this.hasOwnProperty("curr");
 };
 
 proto.advance = function advance(){
-	if (this.cachedData.length === 0){
+	if (this.offset >= this.length){
 		delete this.curr;
 		return false;
 	}
-	this.curr = this.cachedData.shift();
+	this.curr = this.cachedData[this.offset++];
 	return this.curr;
 };
 

+ 3 - 3
package.json

@@ -1,6 +1,6 @@
 {
   "name": "mungedb-aggregate",
-  "version": "0.6.4+2013.12.30",
+  "version": "0.6.5+2014.01.13",
   "description": "A JavaScript data aggregation pipeline based on the MongoDB aggregation framework.",
   "author": "Rivera Group <support@riverainc.com>",
   "contributors": [
@@ -15,7 +15,7 @@
     "test": "npm_scripts/test/test.sh"
   },
   "repository": {
-    "url": "git+https://source.rd.rcg.local/git/private/mungedb-aggregate.git#master"
+    "url": "git+https://source.rd.rcg.local/git/private/mungedb-aggregate.git#release/v0.6.5+2014.01.13"
   },
   "keywords": [
     "manipulation",
@@ -23,7 +23,7 @@
   ],
   "dependencies": {
     "sift": "*",
-    "async": "*"
+	"async":"git+https://github.com/louischatriot/async"
   },
   "devDependencies": {
     "mocha": "*",