Skip to content

Commit

Permalink
Fix AsyncIterator.prototype.throttle
Browse files Browse the repository at this point in the history
PR-URL: #424
  • Loading branch information
ivan-tymoshenko authored and nechaido committed Apr 22, 2019
1 parent f3dd5c9 commit e2db419
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/async-iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ class AsyncIterator {
return this;
}

throttle(percent) {
return new ThrottleIterator(this, percent);
throttle(percent, min) {
return new ThrottleIterator(this, percent, min);
}

enumerate() {
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ metatests.test('new AsyncIterator() on non Iterable', test => {
test.end();
});

metatests.test('AsyncIterator.throttle with min value', test => {
const expectedMin = 1;
const { min } = asyncIter([]).throttle(1, expectedMin);
test.strictSame(min, expectedMin);
test.end();
});

metatests.test('new AsyncIterator() on AsyncIterable', test => {
const iterator = array[Symbol.iterator]();
const iterable = {
Expand Down

0 comments on commit e2db419

Please sign in to comment.