diff options
author | Alexander Early <alexander.early@gmail.com> | 2018-07-08 17:15:09 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2018-07-08 17:15:09 -0700 |
commit | d82becb8692e131cbc27cdb172fb7563dfdc80e3 (patch) | |
tree | 21cfd16d27143bc2dc3b51732ef5fc1de8003bb1 | |
parent | d1374d0155867f76578748595eddf84b6a9f007d (diff) | |
download | async-d82becb8692e131cbc27cdb172fb7563dfdc80e3.tar.gz |
add pitfall about array mutation. Closes #1393
-rw-r--r-- | intro.md | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -206,6 +206,10 @@ As of version 3.0, you can call any Async callback with `false` as the `error` a }, ``` +### Mutating collections + +If you pass an array to a collection method (such as `each`, `mapLimit`, or `filterSeries`), and then attempt to `push`, `pop`, or `splice` additional items on to the array, this could lead to unexpected or undefined behavior. Async will iterate until the original `length` of the array is met, and the indexes of items `pop()`ed or `splice()`d could already have been processed. Therefore, it is not recommended to modify the array after Async has begun iterating over it. If you do need to `push`, `pop`, or `splice`, use a `queue` instead. + ## Download |