diff options
author | Alex Early <alexander.early@gmail.com> | 2018-07-01 17:54:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-01 17:54:54 -0700 |
commit | 6405b109fe60541ff42d7638ac891d321d6a7bb3 (patch) | |
tree | b6e48ce31446c7cd77a7fc62fe39d62ede8f5c36 /lib/internal/eachOfLimit.js | |
parent | 53f613039af68353371c2953446fa8084b3fc86b (diff) | |
download | async-6405b109fe60541ff42d7638ac891d321d6a7bb3.tar.gz |
limits of less than 1 are now an error (#1552)
* BREAKING CHANGE: limits of less than 1 are now an error
* fix lint
Diffstat (limited to 'lib/internal/eachOfLimit.js')
-rw-r--r-- | lib/internal/eachOfLimit.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/internal/eachOfLimit.js b/lib/internal/eachOfLimit.js index ae153b1..2928366 100644 --- a/lib/internal/eachOfLimit.js +++ b/lib/internal/eachOfLimit.js @@ -9,7 +9,10 @@ import breakLoop from './breakLoop'; export default function _eachOfLimit(limit) { return function (obj, iteratee, callback) { callback = once(callback || noop); - if (limit <= 0 || !obj) { + if (limit <= 0) { + throw new RangeError('concurrency limit cannot be less than 1') + } + if (!obj) { return callback(null); } var nextElem = iterator(obj); |