Skip to content

Commit e2db419

Browse files
ivan-tymoshenkonechaido
authored andcommitted
Fix AsyncIterator.prototype.throttle
PR-URL: #424
1 parent f3dd5c9 commit e2db419

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/async-iterator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ class AsyncIterator {
188188
return this;
189189
}
190190

191-
throttle(percent) {
192-
return new ThrottleIterator(this, percent);
191+
throttle(percent, min) {
192+
return new ThrottleIterator(this, percent, min);
193193
}
194194

195195
enumerate() {

test/fixtures/iterator.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ metatests.test('new AsyncIterator() on non Iterable', test => {
1515
test.end();
1616
});
1717

18+
metatests.test('AsyncIterator.throttle with min value', test => {
19+
const expectedMin = 1;
20+
const { min } = asyncIter([]).throttle(1, expectedMin);
21+
test.strictSame(min, expectedMin);
22+
test.end();
23+
});
24+
1825
metatests.test('new AsyncIterator() on AsyncIterable', test => {
1926
const iterator = array[Symbol.iterator]();
2027
const iterable = {

0 commit comments

Comments
 (0)