From abd94a7f5a50f43c797a11b53549ae48fff667c3 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 10 Oct 2016 03:43:44 +0200 Subject: add node_modules to address #4364 --- node_modules/when/parallel.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 node_modules/when/parallel.js (limited to 'node_modules/when/parallel.js') diff --git a/node_modules/when/parallel.js b/node_modules/when/parallel.js new file mode 100644 index 000000000..6616a82be --- /dev/null +++ b/node_modules/when/parallel.js @@ -0,0 +1,39 @@ +/** @license MIT License (c) copyright 2011-2013 original author or authors */ + +/** + * parallel.js + * + * Run a set of task functions in parallel. All tasks will + * receive the same args + * + * @author Brian Cavalier + * @author John Hann + */ + +(function(define) { +define(function(require) { + + var when = require('./when'); + var all = when.Promise.all; + var slice = Array.prototype.slice; + + /** + * Run array of tasks in parallel + * @param tasks {Array|Promise} array or promiseForArray of task functions + * @param [args] {*} arguments to be passed to all tasks + * @return {Promise} promise for array containing the + * result of each task in the array position corresponding + * to position of the task in the tasks array + */ + return function parallel(tasks /*, args... */) { + return all(slice.call(arguments, 1)).then(function(args) { + return when.map(tasks, function(task) { + return task.apply(void 0, args); + }); + }); + }; + +}); +})(typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }); + + -- cgit v1.2.3