Skip to content

Commit 0617065

Browse files
fix lint and tests
1 parent 3347d44 commit 0617065

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,12 @@ export type { RunCursorCommandOptions } from './cursor/run_command_cursor';
364364
export type { DbOptions, DbPrivate } from './db';
365365
export type { Encrypter, EncrypterOptions } from './encrypter';
366366
export type { AnyError, ErrorDescription, MongoNetworkErrorOptions } from './error';
367-
export type { Explain, ExplainOptions, ExplainVerbosityLike } from './explain';
367+
export type {
368+
Explain,
369+
ExplainCommandOptions,
370+
ExplainOptions,
371+
ExplainVerbosityLike
372+
} from './explain';
368373
export type {
369374
GridFSBucketReadStreamOptions,
370375
GridFSBucketReadStreamOptionsWithRevision,

test/integration/shared.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,14 @@ function dropCollection(dbObj, collectionName, options = {}) {
6363
* @returns a function that collects the specified comment events
6464
*/
6565
function filterForCommands(commands, bag) {
66-
const predicate =
67-
typeof commands === 'function'
68-
? commands
69-
: command => {
70-
const specifiedCommandNames = [commands].flat();
71-
return specifiedCommandNames.includes(command.commandName);
72-
};
66+
if (typeof commands === 'function') {
67+
return function (event) {
68+
if (commands(event.commandName)) bag.push(event);
69+
};
70+
}
71+
commands = Array.isArray(commands) ? commands : [commands];
7372
return function (event) {
74-
if (predicate(event.commandName)) bag.push(event);
73+
if (commands.indexOf(event.commandName) !== -1) bag.push(event);
7574
};
7675
}
7776

0 commit comments

Comments
 (0)