Projekt

Obecné

Profil

Stáhnout (12 KB) Statistiky
| Větev: | Revize:
1
<h1 align="center">Neo-Async</h1>
2

    
3
<p align="center">
4
  <img src="https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/neo_async_v2.png" width="250px" />
5
</p>
6

    
7
<p align="center">
8
  <a href="https://www.npmjs.com/package/neo-async"><img alt="npm" src="https://img.shields.io/npm/v/neo-async.svg"></a>
9
  <a href="https://travis-ci.org/suguru03/neo-async"><img alt="Travis Status" src="https://img.shields.io/travis/suguru03/neo-async.svg"></a>
10
  <a href="https://codecov.io/gh/suguru03/neo-async"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/suguru03/neo-async/master.svg"></a>
11
  <a href="https://www.npmjs.com/package/neo-async"><img alt="download" src="https://img.shields.io/npm/dm/neo-async.svg"></a>
12
  <a href="https://lgtm.com/projects/g/suguru03/neo-async/context:javascript"><img src="https://img.shields.io/lgtm/grade/javascript/g/suguru03/neo-async.svg?logo=lgtm&logoWidth=18" alt="Code Quality: Javascript" height="18"></a>
13
  <a href="https://lgtm.com/projects/g/suguru03/neo-async/alerts"><img src="https://img.shields.io/lgtm/alerts/g/suguru03/neo-async.svg?logo=lgtm&logoWidth=18" alt="Total Alerts" height="18"></a>
14
</p>
15

    
16
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).
17

    
18
Benchmark is [here](#benchmark)!
19

    
20
Bluebird's benchmark is [here](https://github.com/suguru03/bluebird/tree/aigle/benchmark)!
21

    
22
## Code Coverage
23
![coverage](https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/coverage.png)
24

    
25
## Installation
26

    
27
### In a browser
28
```html
29
<script src="async.min.js"></script>
30
```
31

    
32
### In an AMD loader
33
```js
34
require(['async'], function(async) {});
35
```
36

    
37
### Promise and async/await
38

    
39
I recommend to use [`Aigle`](https://github.com/suguru03/aigle).
40

    
41
It is optimized for Promise handling and has almost the same functionality as `neo-async`.
42

    
43
### Node.js
44

    
45
#### standard
46

    
47
```bash
48
$ npm install neo-async
49
```
50
```js
51
var async = require('neo-async');
52
```
53

    
54
#### replacement
55
```bash
56
$ npm install neo-async
57
$ ln -s ./node_modules/neo-async ./node_modules/async
58
```
59
```js
60
var async = require('async');
61
```
62

    
63
### Bower
64

    
65
```bash
66
bower install neo-async
67
```
68

    
69
## Feature
70

    
71
[JSDoc](http://suguru03.github.io/neo-async/doc/async.html)
72

    
73
\* not in Async
74

    
75
### Collections
76

    
77
- [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
78
- [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
79
- [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
80
- [`forEach`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
81
- [`forEachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
82
- [`forEachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
83
- [`eachOf`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
84
- [`eachOfSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
85
- [`eachOfLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
86
- [`forEachOf`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
87
- [`forEachOfSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
88
- [`eachOfLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`forEachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
89
- [`map`](http://suguru03.github.io/neo-async/doc/async.map.html)
90
- [`mapSeries`](http://suguru03.github.io/neo-async/doc/async.mapSeries.html)
91
- [`mapLimit`](http://suguru03.github.io/neo-async/doc/async.mapLimit.html)
92
- [`mapValues`](http://suguru03.github.io/neo-async/doc/async.mapValues.html)
93
- [`mapValuesSeries`](http://suguru03.github.io/neo-async/doc/async.mapValuesSeries.html)
94
- [`mapValuesLimit`](http://suguru03.github.io/neo-async/doc/async.mapValuesLimit.html)
95
- [`filter`](http://suguru03.github.io/neo-async/doc/async.filter.html)
96
- [`filterSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html)
97
- [`filterLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html)
98
- [`select`](http://suguru03.github.io/neo-async/doc/async.filter.html) -> [`filter`](http://suguru03.github.io/neo-async/doc/async.filter.html)
99
- [`selectSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html) -> [`filterSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html)
100
- [`selectLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html) -> [`filterLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html)
101
- [`reject`](http://suguru03.github.io/neo-async/doc/async.reject.html)
102
- [`rejectSeries`](http://suguru03.github.io/neo-async/doc/async.rejectSeries.html)
103
- [`rejectLimit`](http://suguru03.github.io/neo-async/doc/async.rejectLimit.html)
104
- [`detect`](http://suguru03.github.io/neo-async/doc/async.detect.html)
105
- [`detectSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html)
106
- [`detectLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html)
107
- [`find`](http://suguru03.github.io/neo-async/doc/async.detect.html) -> [`detect`](http://suguru03.github.io/neo-async/doc/async.detect.html)
108
- [`findSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html) -> [`detectSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html)
109
- [`findLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html) -> [`detectLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html)
110
- [`pick`](http://suguru03.github.io/neo-async/doc/async.pick.html) *
111
- [`pickSeries`](http://suguru03.github.io/neo-async/doc/async.pickSeries.html) *
112
- [`pickLimit`](http://suguru03.github.io/neo-async/doc/async.pickLimit.html) *
113
- [`omit`](http://suguru03.github.io/neo-async/doc/async.omit.html) *
114
- [`omitSeries`](http://suguru03.github.io/neo-async/doc/async.omitSeries.html) *
115
- [`omitLimit`](http://suguru03.github.io/neo-async/doc/async.omitLimit.html) *
116
- [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
117
- [`inject`](http://suguru03.github.io/neo-async/doc/async.reduce.html) -> [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
118
- [`foldl`](http://suguru03.github.io/neo-async/doc/async.reduce.html) -> [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
119
- [`reduceRight`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html)
120
- [`foldr`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html) -> [`reduceRight`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html)
121
- [`transform`](http://suguru03.github.io/neo-async/doc/async.transform.html)
122
- [`transformSeries`](http://suguru03.github.io/neo-async/doc/async.transformSeries.html) *
123
- [`transformLimit`](http://suguru03.github.io/neo-async/doc/async.transformLimit.html) *
124
- [`sortBy`](http://suguru03.github.io/neo-async/doc/async.sortBy.html)
125
- [`sortBySeries`](http://suguru03.github.io/neo-async/doc/async.sortBySeries.html) *
126
- [`sortByLimit`](http://suguru03.github.io/neo-async/doc/async.sortByLimit.html) *
127
- [`some`](http://suguru03.github.io/neo-async/doc/async.some.html)
128
- [`someSeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html)
129
- [`someLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html)
130
- [`any`](http://suguru03.github.io/neo-async/doc/async.some.html) -> [`some`](http://suguru03.github.io/neo-async/doc/async.some.html)
131
- [`anySeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html) -> [`someSeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html)
132
- [`anyLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html) -> [`someLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html)
133
- [`every`](http://suguru03.github.io/neo-async/doc/async.every.html)
134
- [`everySeries`](http://suguru03.github.io/neo-async/doc/async.everySeries.html)
135
- [`everyLimit`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html)
136
- [`all`](http://suguru03.github.io/neo-async/doc/async.every.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.every.html)
137
- [`allSeries`](http://suguru03.github.io/neo-async/doc/async.everySeries.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.everySeries.html)
138
- [`allLimit`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html)
139
- [`concat`](http://suguru03.github.io/neo-async/doc/async.concat.html)
140
- [`concatSeries`](http://suguru03.github.io/neo-async/doc/async.concatSeries.html)
141
- [`concatLimit`](http://suguru03.github.io/neo-async/doc/async.concatLimit.html) *
142

    
143
### Control Flow
144

    
145
- [`parallel`](http://suguru03.github.io/neo-async/doc/async.parallel.html)
146
- [`series`](http://suguru03.github.io/neo-async/doc/async.series.html)
147
- [`parallelLimit`](http://suguru03.github.io/neo-async/doc/async.series.html)
148
- [`tryEach`](http://suguru03.github.io/neo-async/doc/async.tryEach.html)
149
- [`waterfall`](http://suguru03.github.io/neo-async/doc/async.waterfall.html)
150
- [`angelFall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) *
151
- [`angelfall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) -> [`angelFall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) *
152
- [`whilst`](#whilst)
153
- [`doWhilst`](#doWhilst)
154
- [`until`](#until)
155
- [`doUntil`](#doUntil)
156
- [`during`](#during)
157
- [`doDuring`](#doDuring)
158
- [`forever`](#forever)
159
- [`compose`](#compose)
160
- [`seq`](#seq)
161
- [`applyEach`](#applyEach)
162
- [`applyEachSeries`](#applyEachSeries)
163
- [`queue`](#queue)
164
- [`priorityQueue`](#priorityQueue)
165
- [`cargo`](#cargo)
166
- [`auto`](#auto)
167
- [`autoInject`](#autoInject)
168
- [`retry`](#retry)
169
- [`retryable`](#retryable)
170
- [`iterator`](#iterator)
171
- [`times`](http://suguru03.github.io/neo-async/doc/async.times.html)
172
- [`timesSeries`](http://suguru03.github.io/neo-async/doc/async.timesSeries.html)
173
- [`timesLimit`](http://suguru03.github.io/neo-async/doc/async.timesLimit.html)
174
- [`race`](#race)
175

    
176
### Utils
177
- [`apply`](#apply)
178
- [`setImmediate`](#setImmediate)
179
- [`nextTick`](#nextTick)
180
- [`memoize`](#memoize)
181
- [`unmemoize`](#unmemoize)
182
- [`ensureAsync`](#ensureAsync)
183
- [`constant`](#constant)
184
- [`asyncify`](#asyncify)
185
- [`wrapSync`](#asyncify) -> [`asyncify`](#asyncify)
186
- [`log`](#log)
187
- [`dir`](#dir)
188
- [`timeout`](http://suguru03.github.io/neo-async/doc/async.timeout.html)
189
- [`reflect`](#reflect)
190
- [`reflectAll`](#reflectAll)
191
- [`createLogger`](#createLogger)
192

    
193
## Mode
194
- [`safe`](#safe) *
195
- [`fast`](#fast) *
196

    
197
## Benchmark
198

    
199
[Benchmark: Async vs Neo-Async](http://suguru03.hatenablog.com/entry/2016/06/10/135559)
200

    
201
### How to check
202

    
203
```bash
204
$ node perf
205
```
206

    
207
### Environment
208

    
209
* Darwin 17.3.0 x64
210
* Node.js v8.9.4
211
* async v2.6.0
212
* neo-async v2.5.0
213
* benchmark v2.1.4
214

    
215
### Result
216

    
217
The value is the ratio (Neo-Async/Async) of the average speed.
218

    
219
#### Collections
220
|function|benchmark|
221
|---|--:|
222
|each/forEach|2.43|
223
|eachSeries/forEachSeries|1.75|
224
|eachLimit/forEachLimit|1.68|
225
|eachOf|3.29|
226
|eachOfSeries|1.50|
227
|eachOfLimit|1.59|
228
|map|3.95|
229
|mapSeries|1.81|
230
|mapLimit|1.27|
231
|mapValues|2.73|
232
|mapValuesSeries|1.59|
233
|mapValuesLimit|1.23|
234
|filter|3.00|
235
|filterSeries|1.74|
236
|filterLimit|1.17|
237
|reject|4.59|
238
|rejectSeries|2.31|
239
|rejectLimit|1.58|
240
|detect|4.30|
241
|detectSeries|1.86|
242
|detectLimit|1.32|
243
|reduce|1.82|
244
|transform|2.46|
245
|sortBy|4.08|
246
|some|2.19|
247
|someSeries|1.83|
248
|someLimit|1.32|
249
|every|2.09|
250
|everySeries|1.84|
251
|everyLimit|1.35|
252
|concat|3.79|
253
|concatSeries|4.45|
254

    
255
#### Control Flow
256
|funciton|benchmark|
257
|---|--:|
258
|parallel|2.93|
259
|series|1.96|
260
|waterfall|1.29|
261
|whilst|1.00|
262
|doWhilst|1.12|
263
|until|1.12|
264
|doUntil|1.12|
265
|during|1.18|
266
|doDuring|2.42|
267
|times|4.25|
268
|auto|1.97|
(2-2/116)