You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

273 lines
12 KiB

3 months ago
  1. <h1 align="center">Neo-Async</h1>
  2. <p align="center">
  3. <img src="https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/neo_async_v2.png" width="250px" />
  4. </p>
  5. <p align="center">
  6. <a href="https://www.npmjs.com/package/neo-async"><img alt="npm" src="https://img.shields.io/npm/v/neo-async.svg"></a>
  7. <a href="https://travis-ci.org/suguru03/neo-async"><img alt="Travis Status" src="https://img.shields.io/travis/suguru03/neo-async.svg"></a>
  8. <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>
  9. <a href="https://www.npmjs.com/package/neo-async"><img alt="download" src="https://img.shields.io/npm/dm/neo-async.svg"></a>
  10. <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>
  11. <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>
  12. <a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fsuguru03%2Fneo-async?ref=badge_shield"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fsuguru03%2Fneo-async.svg?type=shield" alt="FOSSA" height="18"></a>
  13. </p>
  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. Benchmark is [here](#benchmark)!
  16. Bluebird's benchmark is [here](https://github.com/suguru03/bluebird/tree/aigle/benchmark)!
  17. ## Code Coverage
  18. ![coverage](https://raw.githubusercontent.com/wiki/suguru03/neo-async/images/coverage.png)
  19. ## Installation
  20. ### In a browser
  21. ```html
  22. <script src="async.min.js"></script>
  23. ```
  24. ### In an AMD loader
  25. ```js
  26. require(['async'], function(async) {});
  27. ```
  28. ### Promise and async/await
  29. I recommend to use [`Aigle`](https://github.com/suguru03/aigle).
  30. It is optimized for Promise handling and has almost the same functionality as `neo-async`.
  31. ### Node.js
  32. #### standard
  33. ```bash
  34. $ npm install neo-async
  35. ```
  36. ```js
  37. var async = require('neo-async');
  38. ```
  39. #### replacement
  40. ```bash
  41. $ npm install neo-async
  42. $ ln -s ./node_modules/neo-async ./node_modules/async
  43. ```
  44. ```js
  45. var async = require('async');
  46. ```
  47. ### Bower
  48. ```bash
  49. bower install neo-async
  50. ```
  51. ## Feature
  52. [JSDoc](http://suguru03.github.io/neo-async/doc/async.html)
  53. \* not in Async
  54. ### Collections
  55. - [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
  56. - [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
  57. - [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
  58. - [`forEach`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
  59. - [`forEachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
  60. - [`forEachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
  61. - [`eachOf`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
  62. - [`eachOfSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
  63. - [`eachOfLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`eachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
  64. - [`forEachOf`](http://suguru03.github.io/neo-async/doc/async.each.html) -> [`each`](http://suguru03.github.io/neo-async/doc/async.each.html)
  65. - [`forEachOfSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html) -> [`eachSeries`](http://suguru03.github.io/neo-async/doc/async.eachSeries.html)
  66. - [`eachOfLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html) -> [`forEachLimit`](http://suguru03.github.io/neo-async/doc/async.eachLimit.html)
  67. - [`map`](http://suguru03.github.io/neo-async/doc/async.map.html)
  68. - [`mapSeries`](http://suguru03.github.io/neo-async/doc/async.mapSeries.html)
  69. - [`mapLimit`](http://suguru03.github.io/neo-async/doc/async.mapLimit.html)
  70. - [`mapValues`](http://suguru03.github.io/neo-async/doc/async.mapValues.html)
  71. - [`mapValuesSeries`](http://suguru03.github.io/neo-async/doc/async.mapValuesSeries.html)
  72. - [`mapValuesLimit`](http://suguru03.github.io/neo-async/doc/async.mapValuesLimit.html)
  73. - [`filter`](http://suguru03.github.io/neo-async/doc/async.filter.html)
  74. - [`filterSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html)
  75. - [`filterLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html)
  76. - [`select`](http://suguru03.github.io/neo-async/doc/async.filter.html) -> [`filter`](http://suguru03.github.io/neo-async/doc/async.filter.html)
  77. - [`selectSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html) -> [`filterSeries`](http://suguru03.github.io/neo-async/doc/async.filterSeries.html)
  78. - [`selectLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html) -> [`filterLimit`](http://suguru03.github.io/neo-async/doc/async.filterLimit.html)
  79. - [`reject`](http://suguru03.github.io/neo-async/doc/async.reject.html)
  80. - [`rejectSeries`](http://suguru03.github.io/neo-async/doc/async.rejectSeries.html)
  81. - [`rejectLimit`](http://suguru03.github.io/neo-async/doc/async.rejectLimit.html)
  82. - [`detect`](http://suguru03.github.io/neo-async/doc/async.detect.html)
  83. - [`detectSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html)
  84. - [`detectLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html)
  85. - [`find`](http://suguru03.github.io/neo-async/doc/async.detect.html) -> [`detect`](http://suguru03.github.io/neo-async/doc/async.detect.html)
  86. - [`findSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html) -> [`detectSeries`](http://suguru03.github.io/neo-async/doc/async.detectSeries.html)
  87. - [`findLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html) -> [`detectLimit`](http://suguru03.github.io/neo-async/doc/async.detectLimit.html)
  88. - [`pick`](http://suguru03.github.io/neo-async/doc/async.pick.html) *
  89. - [`pickSeries`](http://suguru03.github.io/neo-async/doc/async.pickSeries.html) *
  90. - [`pickLimit`](http://suguru03.github.io/neo-async/doc/async.pickLimit.html) *
  91. - [`omit`](http://suguru03.github.io/neo-async/doc/async.omit.html) *
  92. - [`omitSeries`](http://suguru03.github.io/neo-async/doc/async.omitSeries.html) *
  93. - [`omitLimit`](http://suguru03.github.io/neo-async/doc/async.omitLimit.html) *
  94. - [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
  95. - [`inject`](http://suguru03.github.io/neo-async/doc/async.reduce.html) -> [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
  96. - [`foldl`](http://suguru03.github.io/neo-async/doc/async.reduce.html) -> [`reduce`](http://suguru03.github.io/neo-async/doc/async.reduce.html)
  97. - [`reduceRight`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html)
  98. - [`foldr`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html) -> [`reduceRight`](http://suguru03.github.io/neo-async/doc/async.reduceRight.html)
  99. - [`transform`](http://suguru03.github.io/neo-async/doc/async.transform.html)
  100. - [`transformSeries`](http://suguru03.github.io/neo-async/doc/async.transformSeries.html) *
  101. - [`transformLimit`](http://suguru03.github.io/neo-async/doc/async.transformLimit.html) *
  102. - [`sortBy`](http://suguru03.github.io/neo-async/doc/async.sortBy.html)
  103. - [`sortBySeries`](http://suguru03.github.io/neo-async/doc/async.sortBySeries.html) *
  104. - [`sortByLimit`](http://suguru03.github.io/neo-async/doc/async.sortByLimit.html) *
  105. - [`some`](http://suguru03.github.io/neo-async/doc/async.some.html)
  106. - [`someSeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html)
  107. - [`someLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html)
  108. - [`any`](http://suguru03.github.io/neo-async/doc/async.some.html) -> [`some`](http://suguru03.github.io/neo-async/doc/async.some.html)
  109. - [`anySeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html) -> [`someSeries`](http://suguru03.github.io/neo-async/doc/async.someSeries.html)
  110. - [`anyLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html) -> [`someLimit`](http://suguru03.github.io/neo-async/doc/async.someLimit.html)
  111. - [`every`](http://suguru03.github.io/neo-async/doc/async.every.html)
  112. - [`everySeries`](http://suguru03.github.io/neo-async/doc/async.everySeries.html)
  113. - [`everyLimit`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html)
  114. - [`all`](http://suguru03.github.io/neo-async/doc/async.every.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.every.html)
  115. - [`allSeries`](http://suguru03.github.io/neo-async/doc/async.everySeries.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.everySeries.html)
  116. - [`allLimit`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html) -> [`every`](http://suguru03.github.io/neo-async/doc/async.everyLimit.html)
  117. - [`concat`](http://suguru03.github.io/neo-async/doc/async.concat.html)
  118. - [`concatSeries`](http://suguru03.github.io/neo-async/doc/async.concatSeries.html)
  119. - [`concatLimit`](http://suguru03.github.io/neo-async/doc/async.concatLimit.html) *
  120. ### Control Flow
  121. - [`parallel`](http://suguru03.github.io/neo-async/doc/async.parallel.html)
  122. - [`series`](http://suguru03.github.io/neo-async/doc/async.series.html)
  123. - [`parallelLimit`](http://suguru03.github.io/neo-async/doc/async.series.html)
  124. - [`tryEach`](http://suguru03.github.io/neo-async/doc/async.tryEach.html)
  125. - [`waterfall`](http://suguru03.github.io/neo-async/doc/async.waterfall.html)
  126. - [`angelFall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) *
  127. - [`angelfall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) -> [`angelFall`](http://suguru03.github.io/neo-async/doc/async.angelFall.html) *
  128. - [`whilst`](#whilst)
  129. - [`doWhilst`](#doWhilst)
  130. - [`until`](#until)
  131. - [`doUntil`](#doUntil)
  132. - [`during`](#during)
  133. - [`doDuring`](#doDuring)
  134. - [`forever`](#forever)
  135. - [`compose`](#compose)
  136. - [`seq`](#seq)
  137. - [`applyEach`](#applyEach)
  138. - [`applyEachSeries`](#applyEachSeries)
  139. - [`queue`](#queue)
  140. - [`priorityQueue`](#priorityQueue)
  141. - [`cargo`](#cargo)
  142. - [`auto`](#auto)
  143. - [`autoInject`](#autoInject)
  144. - [`retry`](#retry)
  145. - [`retryable`](#retryable)
  146. - [`iterator`](#iterator)
  147. - [`times`](http://suguru03.github.io/neo-async/doc/async.times.html)
  148. - [`timesSeries`](http://suguru03.github.io/neo-async/doc/async.timesSeries.html)
  149. - [`timesLimit`](http://suguru03.github.io/neo-async/doc/async.timesLimit.html)
  150. - [`race`](#race)
  151. ### Utils
  152. - [`apply`](#apply)
  153. - [`setImmediate`](#setImmediate)
  154. - [`nextTick`](#nextTick)
  155. - [`memoize`](#memoize)
  156. - [`unmemoize`](#unmemoize)
  157. - [`ensureAsync`](#ensureAsync)
  158. - [`constant`](#constant)
  159. - [`asyncify`](#asyncify)
  160. - [`wrapSync`](#asyncify) -> [`asyncify`](#asyncify)
  161. - [`log`](#log)
  162. - [`dir`](#dir)
  163. - [`timeout`](http://suguru03.github.io/neo-async/doc/async.timeout.html)
  164. - [`reflect`](#reflect)
  165. - [`reflectAll`](#reflectAll)
  166. - [`createLogger`](#createLogger)
  167. ## Mode
  168. - [`safe`](#safe) *
  169. - [`fast`](#fast) *
  170. ## Benchmark
  171. [Benchmark: Async vs Neo-Async](http://suguru03.hatenablog.com/entry/2016/06/10/135559)
  172. ### How to check
  173. ```bash
  174. $ node perf
  175. ```
  176. ### Environment
  177. * Darwin 17.3.0 x64
  178. * Node.js v8.9.4
  179. * async v2.6.0
  180. * neo-async v2.5.0
  181. * benchmark v2.1.4
  182. ### Result
  183. The value is the ratio (Neo-Async/Async) of the average speed.
  184. #### Collections
  185. |function|benchmark|
  186. |---|--:|
  187. |each/forEach|2.43|
  188. |eachSeries/forEachSeries|1.75|
  189. |eachLimit/forEachLimit|1.68|
  190. |eachOf|3.29|
  191. |eachOfSeries|1.50|
  192. |eachOfLimit|1.59|
  193. |map|3.95|
  194. |mapSeries|1.81|
  195. |mapLimit|1.27|
  196. |mapValues|2.73|
  197. |mapValuesSeries|1.59|
  198. |mapValuesLimit|1.23|
  199. |filter|3.00|
  200. |filterSeries|1.74|
  201. |filterLimit|1.17|
  202. |reject|4.59|
  203. |rejectSeries|2.31|
  204. |rejectLimit|1.58|
  205. |detect|4.30|
  206. |detectSeries|1.86|
  207. |detectLimit|1.32|
  208. |reduce|1.82|
  209. |transform|2.46|
  210. |sortBy|4.08|
  211. |some|2.19|
  212. |someSeries|1.83|
  213. |someLimit|1.32|
  214. |every|2.09|
  215. |everySeries|1.84|
  216. |everyLimit|1.35|
  217. |concat|3.79|
  218. |concatSeries|4.45|
  219. #### Control Flow
  220. |funciton|benchmark|
  221. |---|--:|
  222. |parallel|2.93|
  223. |series|1.96|
  224. |waterfall|1.29|
  225. |whilst|1.00|
  226. |doWhilst|1.12|
  227. |until|1.12|
  228. |doUntil|1.12|
  229. |during|1.18|
  230. |doDuring|2.42|
  231. |times|4.25|
  232. |auto|1.97|
  233. ## License
  234. [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fsuguru03%2Fneo-async.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fsuguru03%2Fneo-async?ref=badge_large)