\hypertarget{md_sfcode_node_modules_run_parallel_README_autotoc_md25964}{}\doxysubsection{Run an array of functions in parallel}\label{md_sfcode_node_modules_run_parallel_README_autotoc_md25964}
 \href{https://saucelabs.com/u/run-parallel}{\texttt{ }}\hypertarget{md_sfcode_node_modules_run_parallel_README_autotoc_md25965}{}\doxysubsection{install}\label{md_sfcode_node_modules_run_parallel_README_autotoc_md25965}

\begin{DoxyCode}{0}
\DoxyCodeLine{npm install run-\/parallel }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_run_parallel_README_autotoc_md25966}{}\doxysubsection{usage}\label{md_sfcode_node_modules_run_parallel_README_autotoc_md25966}
\hypertarget{md_sfcode_node_modules_run_parallel_README_autotoc_md25967}{}\doxysubsubsection{parallel(tasks, \mbox{[}callback\mbox{]})}\label{md_sfcode_node_modules_run_parallel_README_autotoc_md25967}
Run the {\ttfamily tasks} array of functions in parallel, without waiting until the previous function has completed. If any of the functions pass an error to its callback, the main {\ttfamily callback} is immediately called with the value of the error. Once the {\ttfamily tasks} have completed, the results are passed to the final {\ttfamily callback} as an array.

It is also possible to use an object instead of an array. Each property will be run as a function and the results will be passed to the final {\ttfamily callback} as an object instead of an array. This can be a more readable way of handling the results.\hypertarget{md_sfcode_node_modules_run_parallel_README_autotoc_md25968}{}\doxyparagraph{arguments}\label{md_sfcode_node_modules_run_parallel_README_autotoc_md25968}

\begin{DoxyItemize}
\item {\ttfamily tasks} -\/ An array or object containing functions to run. Each function is passed a {\ttfamily callback(err, result)} which it must call on completion with an error {\ttfamily err} (which can be {\ttfamily null}) and an optional {\ttfamily result} value.
\item {\ttfamily callback(err, results)} -\/ An optional callback to run once all the functions have completed. This function gets a results array (or object) containing all the result arguments passed to the task callbacks.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_run_parallel_README_autotoc_md25969}{}\doxyparagraph{example}\label{md_sfcode_node_modules_run_parallel_README_autotoc_md25969}

\begin{DoxyCode}{0}
\DoxyCodeLine{var parallel = require('run-\/parallel')}
\DoxyCodeLine{}
\DoxyCodeLine{parallel([}
\DoxyCodeLine{  function (callback) \{}
\DoxyCodeLine{    setTimeout(function () \{}
\DoxyCodeLine{      callback(null, 'one')}
\DoxyCodeLine{    \}, 200)}
\DoxyCodeLine{  \},}
\DoxyCodeLine{  function (callback) \{}
\DoxyCodeLine{    setTimeout(function () \{}
\DoxyCodeLine{      callback(null, 'two')}
\DoxyCodeLine{    \}, 100)}
\DoxyCodeLine{  \}}
\DoxyCodeLine{],}
\DoxyCodeLine{// optional callback}
\DoxyCodeLine{function (err, results) \{}
\DoxyCodeLine{  // the results array will equal ['one','two'] even though}
\DoxyCodeLine{  // the second function had a shorter timeout.}
\DoxyCodeLine{\}) }

\end{DoxyCode}


This module is basically equavalent to \href{https://github.com/caolan/async\#paralleltasks-callback}{\texttt{ {\ttfamily async.\+parallel}}}, but it\textquotesingle{}s handy to just have the one function you need instead of the kitchen sink. Modularity! Especially handy if you\textquotesingle{}re serving to the browser and need to reduce your javascript bundle size.

Works great in the browser with \href{http://browserify.org/}{\texttt{ browserify}}!\hypertarget{md_sfcode_node_modules_run_parallel_README_autotoc_md25970}{}\doxysubsection{see also}\label{md_sfcode_node_modules_run_parallel_README_autotoc_md25970}

\begin{DoxyItemize}
\item \href{https://github.com/feross/run-auto}{\texttt{ run-\/auto}}
\item \href{https://github.com/feross/run-parallel-limit}{\texttt{ run-\/parallel-\/limit}}
\item \href{https://github.com/feross/run-series}{\texttt{ run-\/series}}
\item \href{https://github.com/feross/run-waterfall}{\texttt{ run-\/waterfall}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_run_parallel_README_autotoc_md25971}{}\doxysubsection{license}\label{md_sfcode_node_modules_run_parallel_README_autotoc_md25971}
MIT. Copyright (c) \href{http://feross.org}{\texttt{ Feross Aboukhadijeh}}. 