Skip to content

Commit

Permalink
Fix incorrect assertion check (#107)
Browse files Browse the repository at this point in the history
8182446 introduced a regression. Here's
the relevant part of that diff:

```
- assert(isFunction(pageCallback),
-     'The first parameter to `eachPage` must be a function');
+ if (!isFunction(done)) {
+     throw new Error('The first parameter to `eachPage` must be a function');
+ }
```

This should have been checking whether `pageCallback` was a function but
instead changed to `done`.

I re-reviewed the original commit and didn't see any other mistakes.
  • Loading branch information
Evan Hahn authored Apr 30, 2019
1 parent 0421165 commit e027f08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var Query = Class.extend({
* `done(error)`.
*/
eachPage: function(pageCallback, done) {
if (!isFunction(done)) {
if (!isFunction(pageCallback)) {
throw new Error('The first parameter to `eachPage` must be a function');
}

Expand Down

0 comments on commit e027f08

Please sign in to comment.