1 | # Neo-Async v2.1.0
|
2 |
|
3 | <img src="https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/neo_async_v2.png" width="230px" />
|
4 |
|
5 | [![npm](https://img.shields.io/npm/v/neo-async.svg)](https://www.npmjs.com/package/neo-async)
|
6 | [![Travis](https://img.shields.io/travis/suguru03/neo-async.svg)](https://travis-ci.org/suguru03/neo-async)
|
7 | [![Codecov](https://img.shields.io/codecov/c/github/suguru03/neo-async.svg)](https://codecov.io/github/suguru03/neo-async?branch=master)
|
8 | [![Dependency Status](https://gemnasium.com/suguru03/neo-async.svg)](https://gemnasium.com/suguru03/neo-async)
|
9 | [![npm](https://img.shields.io/npm/dm/neo-async.svg)](https://www.npmjs.com/package/neo-async)
|
10 |
|
11 | [![nodei](https://nodei.co/npm/neo-async.png?stars=true&downloads=true&downloadRank=true)](http://npm-stat.com/charts.html?package=neo-async)
|
12 |
|
13 |
|
14 | Neo-Async is thought to be used as a drop-in replacement for [Async](https://github.com/caolan/async), it almost fully covers its functionality and runs [faster](#benchmark).
|
15 |
|
16 | Benchmark is [here](#benchmark)!
|
17 |
|
18 | ## Code Coverage
|
19 | ![coverage](https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/coverage.png)
|
20 |
|
21 | ## Installation
|
22 |
|
23 | ### In a browser
|
24 | ```html
|
25 | <script src="async.min.js"></script>
|
26 | ```
|
27 |
|
28 | ### In an AMD loader
|
29 | ```js
|
30 | require(['async'], function(async) {});
|
31 | ```
|
32 |
|
33 | ### Node.js
|
34 |
|
35 | #### standard
|
36 |
|
37 | ```bash
|
38 | $ npm install neo-async
|
39 | ```
|
40 | ```js
|
41 | var async = require('neo-async');
|
42 | ```
|
43 |
|
44 | #### replacement
|
45 | ```bash
|
46 | $ npm install neo-async
|
47 | $ ln -s ./node_modules/neo-async ./node_modules/async
|
48 | ```
|
49 | ```js
|
50 | var async = require('async');
|
51 | ```
|
52 |
|
53 | ### Bower
|
54 |
|
55 | ```bash
|
56 | bower install neo-async
|
57 | ```
|
58 |
|
59 | ## Feature
|
60 |
|
61 | [JSDoc](http://suguru03.github.io/neo-async/doc/async.html)
|
62 |
|
63 | \* not in Async
|
64 |
|
65 | ### Collections
|
66 |
|
67 | - [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
|
68 | - [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
|
69 | - [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
|
70 | - [`forEach`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
|
71 | - [`forEachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
|
72 | - [`forEachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
|
73 | - [`eachOf`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
|
74 | - [`eachOfSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
|
75 | - [`eachOfLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
|
76 | - [`forEachOf`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
|
77 | - [`forEachOfSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
|
78 | - [`eachOfLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`forEachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
|
79 | - [`map`](http://suguru03.github.io/neo-async/doc/async.map.html)
|
80 | - [`mapSeries`](http://suguru03.github.io/neo-async/doc/async.mapSeries.html)
|
81 | - [`mapLimit`](http://suguru03.github.io/neo-async/doc/async.mapLimit.html)
|
82 | - [`mapValues`](http://suguru03.github.io/neo-async/doc/async.mapValues.html)
|
83 | - [`mapValuesSeries`](http://suguru03.github.io/neo-async/doc/async.mapValuesSeries.html)
|
84 | - [`mapValuesLimit`](http://suguru03.github.io/neo-async/doc/async.mapValuesLimit.html)
|
85 | - [`filter`](http://suguru03.github.io/neo-async/doc/async.filter.html)
|
86 | - [`filterSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html)
|
87 | - [`filterLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html)
|
88 | - [`select`](http://suguru03.github.io/neo-async/doc/async.filter.html) -> [`filter`](http://suguru03.github.io/neo-async/doc/async.filter.html)
|
89 | - [`selectSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html) -> [`filterSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html)
|
90 | - [`selectLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html) -> [`filterLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html)
|
91 | - [`reject`](http://suguru03.github.io/neo-async/doc/async.reject.html)
|
92 | - [`rejectSeries`](http://suguru03.github.io/neo-async/doc/async.rejectSeries.html)
|
93 | - [`rejectLimit`](http://suguru03.github.io/neo-async/doc/async.rejectLimit.html)
|
94 | - [`detect`](http://suguru03.github.io/neo-async/doc/async.detect.html)
|
95 | - [`detectSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html)
|
96 | - [`detectLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html)
|
97 | - [`find`](http://suguru03.github.io/neo-async/doc/async.detect.html) -> [`detect`](http://suguru03.github.io/neo-async/doc/async.detect.html)
|
98 | - [`findSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html) -> [`detectSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html)
|
99 | - [`findLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html) -> [`detectLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html)
|
100 | - [`pick`](http://suguru03.github.io/neo-async/doc/async.pick.html) *
|
101 | - [`pickSeries`](http://suguru03.github.io/neo-async/doc/async.pickSeries.html) *
|
102 | - [`pickLimit`](http://suguru03.github.io/neo-async/doc/async.pickLimit.html) *
|
103 | - [`omit`](http://suguru03.github.io/neo-async/doc/async.omit.html) *
|
104 | - [`omitSeries`](http://suguru03.github.io/neo-async/doc/async.omitSeries.html) *
|
105 | - [`omitLimit`](http://suguru03.github.io/neo-async/doc/async.omitLimit.html) *
|
106 | - [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
|
107 | - [`inject`](http://suguru03.github.io/neo-async/doc/async.reduce.html) -> [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
|
108 | - [`foldl`](http://suguru03.github.io/neo-async/doc/async.reduce.html) -> [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
|
109 | - [`reduceRight`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html)
|
110 | - [`foldr`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html) -> [`reduceRight`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html)
|
111 | - [`transform`](http://suguru03.github.io/neo-async/doc/async.transform.html)
|
112 | - [`transformSeries`](http://suguru03.github.io/neo-async/doc/async.transformSeries.html) *
|
113 | - [`transformLimit`](http://suguru03.github.io/neo-async/doc/async.transformLimit.html) *
|
114 | - [`sortBy`](http://suguru03.github.io/neo-async/doc/async.sortBy.html)
|
115 | - [`sortBySeries`](http://suguru03.github.io/neo-async/doc/async.sortBySeries.html) *
|
116 | - [`sortByLimit`](http://suguru03.github.io/neo-async/doc/async.sortByLimit.html) *
|
117 | - [`some`](http://suguru03.github.io/neo-async/doc/async.some.html)
|
118 | - [`someSeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html)
|
119 | - [`someLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html)
|
120 | - [`any`](http://suguru03.github.io/neo-async/doc/async.some.html) -> [`some`](http://suguru03.github.io/neo-async/doc/async.some.html)
|
121 | - [`anySeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html) -> [`someSeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html)
|
122 | - [`anyLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html) -> [`someLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html)
|
123 | - [`every`](http://suguru03.github.io/neo-async/doc/async.every.html)
|
124 | - [`everySeries`](http://suguru03.github.io/neo-async/doc/async.everySeries.html)
|
125 | - [`everyLimit`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html)
|
126 | - [`all`](http://suguru03.github.io/neo-async/doc/async.every.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.every.html)
|
127 | - [`allSeries`](http://suguru03.github.io/neo-async/doc/async.everySeries.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.everySeries.html)
|
128 | - [`allLimit`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html)
|
129 | - [`concat`](http://suguru03.github.io/neo-async/doc/async.concat.html)
|
130 | - [`concatSeries`](http://suguru03.github.io/neo-async/doc/async.concatSeries.html)
|
131 | - [`concatLimit`](http://suguru03.github.io/neo-async/doc/async.concatLimit.html) *
|
132 |
|
133 | ### Control Flow
|
134 |
|
135 | - [`parallel`](http://suguru03.github.io/neo-async/doc/async.parallel.html)
|
136 | - [`series`](http://suguru03.github.io/neo-async/doc/async.series.html)
|
137 | - [`parallelLimit`](http://suguru03.github.io/neo-async/doc/async.series.html)
|
138 | - [`waterfall`](http://suguru03.github.io/neo-async/doc/async.waterfall.html)
|
139 | - [`angelFall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) *
|
140 | - [`angelfall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) -> [`angelFall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) *
|
141 | - [`whilst`](#whilst)
|
142 | - [`doWhilst`](#doWhilst)
|
143 | - [`until`](#until)
|
144 | - [`doUntil`](#doUntil)
|
145 | - [`during`](#during)
|
146 | - [`doDuring`](#doDuring)
|
147 | - [`forever`](#forever)
|
148 | - [`compose`](#compose)
|
149 | - [`seq`](#seq)
|
150 | - [`applyEach`](#applyEach)
|
151 | - [`applyEachSeries`](#applyEachSeries)
|
152 | - [`queue`](#queue)
|
153 | - [`priorityQueue`](#priorityQueue)
|
154 | - [`cargo`](#cargo)
|
155 | - [`auto`](#auto)
|
156 | - [`autoInject`](#autoInject)
|
157 | - [`retry`](#retry)
|
158 | - [`retryable`](#retryable)
|
159 | - [`iterator`](#iterator)
|
160 | - [`times`](http://suguru03.github.io/neo-async/doc/async.times.html)
|
161 | - [`timesSeries`](http://suguru03.github.io/neo-async/doc/async.timesSeries.html)
|
162 | - [`timesLimit`](http://suguru03.github.io/neo-async/doc/async.timesLimit.html)
|
163 | - [`race`](#race)
|
164 |
|
165 | ### Utils
|
166 | - [`apply`](#apply)
|
167 | - [`setImmediate`](#setImmediate)
|
168 | - [`nextTick`](#nextTick)
|
169 | - [`memoize`](#memoize)
|
170 | - [`unmemoize`](#unmemoize)
|
171 | - [`ensureAsync`](#ensureAsync)
|
172 | - [`constant`](#constant)
|
173 | - [`asyncify`](#asyncify)
|
174 | - [`wrapSync`](#asyncify) -> [`asyncify`](#asyncify)
|
175 | - [`log`](#log)
|
176 | - [`dir`](#dir)
|
177 | - [`timeout`](http://suguru03.github.io/neo-async/doc/async.timeout.html)
|
178 | - [`reflect`](#reflect)
|
179 | - [`reflectAll`](#reflectAll)
|
180 | - [`createLogger`](#createLogger)
|
181 |
|
182 | ## Mode
|
183 | - [`safe`](#safe) *
|
184 | - [`fast`](#fast) *
|
185 |
|
186 | ## Benchmark
|
187 |
|
188 | [Benchmark: Async vs Neo-Async](http://suguru03.hatenablog.com/entry/2016/06/10/135559)
|
189 |
|
190 | ### How to check
|
191 |
|
192 | ```bash
|
193 | $ git clone git@github.com:suguru03/async-benchmark.git
|
194 | $ cd async-benchmark
|
195 | $ npm install
|
196 | $ node . // It might take more than one hour...
|
197 | ```
|
198 |
|
199 | ### Environment
|
200 |
|
201 | * Ubuntu v12.04
|
202 | * Node.js v6.2.1
|
203 | * async v2.0.0-rc.6
|
204 | * neo-async v2.0.0-rc.1
|
205 | * benchmark v2.1.0
|
206 | * func-comparator v0.7.1
|
207 |
|
208 | ### Result
|
209 |
|
210 | Neo-Async is 1.27 ~ 10.7 times faster than Async.
|
211 |
|
212 | The value is the ratio (Neo-Async/Async) of the average speed.
|
213 |
|
214 | #### Collections
|
215 | |function|benchmark|func-comparator|
|
216 | |---|--:|--:|
|
217 | |each|3.71|2.54|
|
218 | |eachSeries|2.14|1.90|
|
219 | |eachLimit|2.14|1.88|
|
220 | |eachOf|3.30|2.50|
|
221 | |eachOfSeries|1.97|1.83|
|
222 | |eachOfLimit|2.02|1.80|
|
223 | |map|4.20|4.11|
|
224 | |mapSeries|2.40|3.65|
|
225 | |mapLimit|2.64|2.66|
|
226 | |mapValues|5.71|5.32|
|
227 | |mapValuesSeries|3.82|3.23|
|
228 | |mapValuesLimit|3.10|2.38|
|
229 | |filter|8.11|8.76|
|
230 | |filterSeries|5.79|4.86|
|
231 | |filterLimit|4.00|3.32|
|
232 | |reject|9.47|9.52|
|
233 | |rejectSeries|7.39|4.64|
|
234 | |rejectLimit|4.54|3.49|
|
235 | |detect|6.67|6.37|
|
236 | |detectSeries|3.54|3.73|
|
237 | |detectLimit|2.38|2.62|
|
238 | |reduce|4.13|3.23|
|
239 | |reduceRight|4.23|3.24|
|
240 | |transform|5.30|5.17|
|
241 | |sortBy|2.24|2.37|
|
242 | |some|6.39|6.10|
|
243 | |someSeries|5.37|4.66|
|
244 | |someLimit|3.39|2.84|
|
245 | |every|6.85|6.27|
|
246 | |everySeries|4.53|3.90|
|
247 | |everyLimit|3.36|2.75|
|
248 | |concat|9.18|9.35|
|
249 | |concatSeries|7.49|6.09|
|
250 |
|
251 | #### Control Flow
|
252 | |funciton|benchmark|func-comparator|
|
253 | |---|--:|--:|
|
254 | |parallel|7.54|5.45|
|
255 | |series|3.29|2.41|
|
256 | |waterfall|5.12|4.27|
|
257 | |whilst|1.96|1.95|
|
258 | |doWhilst|2.07|1.96|
|
259 | |until|2.10|1.99|
|
260 | |doUntil|1.98|2.04|
|
261 | |during|10.7|7.09|
|
262 | |doDuring|5.98|6.03|
|
263 | |queue|1.83|1.75|
|
264 | |priorityQueue|1.79|1.75|
|
265 | |times|3.84|3.65|
|
266 | |race|1.45|1.27|
|
267 | |auto|3.23|3.50|
|
268 | |retry|9.43|6.78|
|
269 |
|