Skip to content

Commit d011408

Browse files
fix options handling
1 parent 1a5ea12 commit d011408

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/legacy_wrappers/cursors.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ module.exports.makeLegacyFindCursor = function (baseClass) {
2626
}
2727

2828
explain(_verbosity, _options, _callback) {
29-
const callback = Array.from(arguments).find(argument => typeof argument === 'function');
29+
const argumentsArray = Array.from(arguments);
30+
const callback = argumentsArray.find(argument => typeof argument === 'function');
31+
callback != null && argumentsArray.pop();
3032
return maybeCallback(super.explain(...arguments), callback);
3133
}
3234

@@ -175,7 +177,9 @@ module.exports.makeLegacyAggregationCursor = function (baseClass) {
175177

176178
class LegacyAggregationCursor extends baseClass {
177179
explain(_verbosity, _options, _callback) {
178-
const callback = Array.from(arguments).find(argument => typeof argument === 'function');
180+
const argumentsArray = Array.from(arguments);
181+
const callback = argumentsArray.find(argument => typeof argument === 'function');
182+
callback != null && argumentsArray.pop();
179183
return maybeCallback(super.explain(...arguments), callback);
180184
}
181185

0 commit comments

Comments
 (0)