node.flow
Advanced tools
Comparing version 0.1.0 to 1.0.0
@@ -0,1 +1,8 @@ | ||
## 1.0.0 / 2012-02-14 | ||
- [bug fix] Parallel arguments from last stack should be overwritten by default arguments | ||
- Added full test | ||
## 0.1.0 / 2012-02-13 | ||
@@ -2,0 +9,0 @@ |
@@ -20,4 +20,8 @@ /*! | ||
var arrays_equal = function ( a,b ){ | ||
return !!a && !!b && ! ( a < b || b < a ); | ||
}; | ||
/** | ||
@@ -50,6 +54,6 @@ * Creates a new Flow. | ||
/** | ||
* Parallel augument stack | ||
* @type {Array} | ||
*/ | ||
this._ready_args = []; | ||
* Parallel augument stack | ||
* @type {Array} | ||
*/ | ||
this._ready_args = []; | ||
@@ -118,5 +122,4 @@ /** | ||
* @this {Flow} | ||
* @param {Array} args Arguments from this.join; to be merged with parallel args. | ||
*/ | ||
_run_parallel : function ( args ){ | ||
_run_parallel : function ( args, merge ){ | ||
var self = this; | ||
@@ -129,8 +132,5 @@ var parallel_args = this._parallel_args.shift(); | ||
var _args = parallel_args.shift(); | ||
var ready; | ||
if( args_form_last_task.length > 0 ){ | ||
ready = _args.pop(); | ||
extend( true, _args, slice.call( args_form_last_task )); | ||
_args.push( ready ); | ||
_args.unshift( args_form_last_task ); | ||
} | ||
@@ -186,6 +186,6 @@ | ||
*/ | ||
_add : function ( args, next_type, callback ){ | ||
_add : function ( args, next_type, callback, merge_default ){ | ||
var self = this; | ||
var task = [].shift.call( args ); | ||
var _args = extend( true, [], this._defaults ); | ||
var _args = merge_default ? extend( true, [], this._defaults ) : []; | ||
@@ -228,3 +228,3 @@ extend( true, _args, slice.call( args )); | ||
self._series.push( task ); | ||
}); | ||
}, true ); | ||
@@ -269,3 +269,3 @@ return this; | ||
self._parallel[ group ].push( task ); | ||
}); | ||
}, true ); | ||
@@ -300,8 +300,28 @@ return this; | ||
this.series( function (){ | ||
var args = arguments.length === 1 && /self\[ '_' \+ next_type \]\.apply\( self, slice\.call\( arguments \)\);/g.test( arguments[ 0 ].toString()) ? | ||
[] : slice.call( arguments ); | ||
this._add([ function (){ | ||
// arguments are `defaults merged with last task args` | ||
var len = arguments.length; | ||
var args = arguments; | ||
// arguments is `next` | ||
if( len === 1 ){ | ||
args = []; | ||
}else{ | ||
// remove the last prop if it is a `next` method | ||
if( /self\[ '_' \+ next_type \]\.apply\( self, slice\.call\( arguments \)\);/g.test( arguments[ len - 1 ])){ | ||
[].pop.call( args ); | ||
args = args[ 0 ]; | ||
} | ||
if( arrays_equal( slice.call( arguments ), this._defaults )){ | ||
args = []; | ||
} | ||
} | ||
self._run_parallel( args ); | ||
}); | ||
}], 'next', function ( args, task ){ | ||
self._series_args.push( args ); | ||
self._series.push( task ); | ||
}, false ); | ||
@@ -308,0 +328,0 @@ this._group++; |
{ | ||
"name" : "node.flow", | ||
"version" : "0.1.0", | ||
"version" : "1.0.0", | ||
"description" : "A deadly simple flow control package for node.js", | ||
@@ -5,0 +5,0 @@ "keywords" : [ "flow", "node.flow", "flow control", "async", "sync", "steps" ], |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
818427
23749
2