@@ -25,11 +25,18 @@ module.exports.makeLegacyFindCursor = function (baseClass) {
25
25
return maybeCallback ( super . count ( options ) , callback ) ;
26
26
}
27
27
28
- explain ( _verbosity , _options , _callback ) {
29
- const argumentsArray = Array . from ( arguments ) ;
30
- const callback = argumentsArray . find ( argument => typeof argument === 'function' ) ;
31
- callback != null && argumentsArray . pop ( ) ;
32
- return maybeCallback ( super . explain ( ...argumentsArray ) , callback ) ;
28
+ explain ( verbosity , options , callback ) {
29
+ callback =
30
+ typeof callback === 'function'
31
+ ? callback
32
+ : typeof options === 'function'
33
+ ? options
34
+ : typeof verbosity === 'function'
35
+ ? verbosity
36
+ : undefined ;
37
+ options = typeof options !== 'function' ? options : undefined ;
38
+ verbosity = typeof verbosity !== 'function' ? verbosity : undefined ;
39
+ return maybeCallback ( super . explain ( ...arguments ) , callback ) ;
33
40
}
34
41
35
42
close ( options , callback ) {
@@ -176,11 +183,18 @@ module.exports.makeLegacyAggregationCursor = function (baseClass) {
176
183
}
177
184
178
185
class LegacyAggregationCursor extends baseClass {
179
- explain ( _verbosity , _options , _callback ) {
180
- const argumentsArray = Array . from ( arguments ) ;
181
- const callback = argumentsArray . find ( argument => typeof argument === 'function' ) ;
182
- callback != null && argumentsArray . pop ( ) ;
183
- return maybeCallback ( super . explain ( ...argumentsArray ) , callback ) ;
186
+ explain ( verbosity , options , callback ) {
187
+ callback =
188
+ typeof callback === 'function'
189
+ ? callback
190
+ : typeof options === 'function'
191
+ ? options
192
+ : typeof verbosity === 'function'
193
+ ? verbosity
194
+ : undefined ;
195
+ options = typeof options !== 'function' ? options : undefined ;
196
+ verbosity = typeof verbosity !== 'function' ? verbosity : undefined ;
197
+ return maybeCallback ( super . explain ( ...arguments ) , callback ) ;
184
198
}
185
199
186
200
close ( options , callback ) {
0 commit comments