1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1 1 1 1 4 4 12 12 1 | define(function () { /** * Returns a function that will execute a list of functions in sequence * passing the same arguments to each one. (useful for batch processing * items during a forEach loop) */ function series(){ var fns = arguments; return function(){ var i = 0, n = fns.length; while (i < n) { fns[i].apply(this, arguments); i += 1; } }; } return series; }); |