Skip to content

Commit 39bf692

Browse files
pahan35mbroadst
authored andcommitted
refactor: simplify invalid options notification processing
1 parent 904dbfd commit 39bf692

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/operations/mongo_client_ops.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,10 +593,12 @@ function validOptions(options) {
593593
continue;
594594
}
595595

596-
if (_validOptions.indexOf(name) === -1 && options.validateOptions) {
597-
return new MongoError(`option ${name} is not supported`);
598-
} else if (_validOptions.indexOf(name) === -1) {
599-
console.warn(`the options [${name}] is not supported`);
596+
if (_validOptions.indexOf(name) === -1) {
597+
if (options.validateOptions) {
598+
return new MongoError(`option ${name} is not supported`);
599+
} else {
600+
console.warn(`the options [${name}] is not supported`);
601+
}
600602
}
601603

602604
if (legacyOptionNames.indexOf(name) !== -1) {

0 commit comments

Comments
 (0)