corrade-nucleus-nucleons – Blame information for rev 36

Subversion Repositories:
Rev:
Rev Author Line No. Line
36 office 1 # Array Series [![Build Status](https://travis-ci.org/component/array-parallel.png)](https://travis-ci.org/component/array-parallel)
2  
3 Call an array of asynchronous functions in parallel
4  
5 ### API
6  
7 #### parallel(fns[, context[, callback]])
8  
9 ```js
10 var parallel = require('array-parallel')
11  
12 parallel([
13 function (done) {
14 done()
15 }
16 ], this, function (err) {
17  
18 })
19 ```
20  
21 #### fns
22  
23 `fns` is an array of functions to call in parallel.
24 The argument signature should be:
25  
26 ```js
27 function (done) {
28 done(new Error())
29 // or
30 done(null, result)
31 }
32 ```
33  
34 That is, each function should only take a `done` as an argument.
35 Each callback should only take an `Error` as the first argument,
36 or a value as the second.
37  
38 #### context
39  
40 Optional context to pass to each `fn`.
41 Basically `fn.call(context, done)`.
42  
43 #### callback(err, results)
44  
45 ```js
46 function (err, results) {
47  
48 }
49 ```
50  
51 Only argument is an `Error` argument.
52 It will be the first error retrieved from all the `fns`.
53 `results` will be an array of results from each `fn`,
54 thus this could be considered an asynchronous version of `[].map`.
55  
56 ### License
57  
58 The MIT License (MIT)
59  
60 Copyright (c) 2013 Jonathan Ong me@jongleberry.com
61  
62 Permission is hereby granted, free of charge, to any person obtaining a copy
63 of this software and associated documentation files (the "Software"), to deal
64 in the Software without restriction, including without limitation the rights
65 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
66 copies of the Software, and to permit persons to whom the Software is
67 furnished to do so, subject to the following conditions:
68  
69 The above copyright notice and this permission notice shall be included in
70 all copies or substantial portions of the Software.
71  
72 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
73 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
74 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
75 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
76 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
77 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
78 THE SOFTWARE.