Comparing version 0.7.6 to 0.7.7
@@ -10,2 +10,21 @@ /* | ||
// Zip two arrays together ala Python | ||
function zip(arr1, arr2) { | ||
var zipped = []; | ||
for (var i = 0; i < Math.min(arr1.length, arr2.length); i++) { | ||
zipped.push([arr1[i], arr2[i]]); | ||
} | ||
return zipped; | ||
} | ||
// Turn input into an array even if undefined | ||
function arrayize(arr) { | ||
if (arr === undefined) { | ||
arr = []; | ||
} else if (!Array.isArray(arr)) { | ||
arr = [arr]; | ||
} | ||
return arr; | ||
} | ||
/* | ||
@@ -41,11 +60,3 @@ * Queue | ||
case 2: // Add blobs to queue | ||
if (options === undefined) { | ||
options = []; | ||
} else { | ||
if (!Array.isArray(options)) { | ||
options = [options]; | ||
} | ||
} | ||
async.map(options, task.bind(this), function(err, results) { | ||
async.map(arrayize(options), task.bind(this), function(err, results) { | ||
done(err, blobs.concat(results)); | ||
@@ -59,3 +70,5 @@ }); | ||
} else if (task.type === 'slice') { // Select up to options.length blobs | ||
async.map(blobs.slice(0, Array.isArray(options) ? options.length : 1), task.bind(this, options), done); | ||
async.map(zip(arrayize(options), blobs), (function(arr, cb) { | ||
task.call(this, arr[0], arr[1], cb); | ||
}).bind(this), done); | ||
} else { // Transform blob on a per task basis | ||
@@ -62,0 +75,0 @@ async.map(blobs, task.bind(this, options), done); |
{ | ||
"name": "gear", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"description": "Gear.js - Task-based build system.", | ||
@@ -5,0 +5,0 @@ "author": "Stephen Murphy <stephen@hypernaut.com>", |
108965
2487