Skip to content

Commit f011f48

Browse files
committed
Added migration guide
1 parent af85bf6 commit f011f48

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

version-1-to-2-guide.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
# Migration guide to upgrade from version 1 to version 2
3+
4+
## Explanation
5+
6+
In version 2.X, modern-async had a major re-design of the API. This re-design occured with the following goals:
7+
8+
* Avoiding function naming conflict with popular libraries (notably lodash)
9+
* Simplifying the API by removing duplicate functions
10+
* Proposing safer default parameters regarding concurrency handling
11+
12+
It can be noted that version 1.0 will still be supported for a reasonable amount of time regarding bug fixes.
13+
14+
## How to migrate ?
15+
16+
In order to migrate from version 1.X to version 2.X you should check the following points:
17+
18+
* Most functions were renamed to add an `async` prefix. Example: `map` => `asyncMap`.
19+
* All functions that had three variants ("normal", `Limit` and `Series`) were simplified to have only 1 function. That function takes a `queueOrConcurrency` argument like the old `Limit` variant, except that argument now has a default value of `1`. Here is how to change these function calls:
20+
* If you used the `Limit` variant, just rename it to the new name. The arguments will remain compatible. Example: `mapLimit(a, b, concurreny)` => `asyncMap(a, b, concurreny)`.
21+
* If you used the `Series` variant, also rename it to the new name. The arguments will also remain compatible. Example: `mapSeries(a, b)` => `asyncMap(a, b)`.
22+
* If you used the "normal" variant (with unlimited concurrency), you must pass `Numbers.POSITIVE_INFINITY` as the `queueOrConcurrency` argument. Example: `map(a, b)` => `asyncMap(a, b, Number.POSITIVE_INFINITY)`. (You should also consider not using infinite concurrency anymore as it tends to be a bad idea in most applications.)

0 commit comments

Comments
 (0)