@@ -177,7 +177,7 @@ function toRecord(value: string): Record<string, any> {
177
177
const keyValuePairs = value . split ( ',' ) ;
178
178
for ( const keyValue of keyValuePairs ) {
179
179
const [ key , value ] = keyValue . split ( ':' ) ;
180
- if ( typeof value === 'undefined' ) {
180
+ if ( value == null ) {
181
181
throw new MongoParseError ( 'Cannot have undefined values in key value pairs' ) ;
182
182
}
183
183
try {
@@ -219,7 +219,7 @@ export function parseOptions(
219
219
mongoClient : MongoClient | MongoClientOptions | undefined = undefined ,
220
220
options : MongoClientOptions = { }
221
221
) : MongoOptions {
222
- if ( typeof mongoClient !== 'undefined' && ! ( mongoClient instanceof MongoClient ) ) {
222
+ if ( mongoClient != null && ! ( mongoClient instanceof MongoClient ) ) {
223
223
options = mongoClient ;
224
224
mongoClient = undefined ;
225
225
}
@@ -284,7 +284,7 @@ export function parseOptions(
284
284
}
285
285
286
286
const objectOptions = new CaseInsensitiveMap (
287
- Object . entries ( options ) . filter ( ( [ , v ] ) => ( v ?? null ) != = null )
287
+ Object . entries ( options ) . filter ( ( [ , v ] ) => v ! = null )
288
288
) ;
289
289
290
290
const allOptions = new CaseInsensitiveMap ( ) ;
@@ -418,7 +418,7 @@ function setOption(
418
418
mongoOptions [ name ] = getUint ( name , values [ 0 ] ) ;
419
419
break ;
420
420
case 'string' :
421
- if ( values [ 0 ] === undefined ) {
421
+ if ( values [ 0 ] == null ) {
422
422
break ;
423
423
}
424
424
mongoOptions [ name ] = String ( values [ 0 ] ) ;
@@ -1051,6 +1051,6 @@ export const OPTIONS = {
1051
1051
1052
1052
export const DEFAULT_OPTIONS = new CaseInsensitiveMap (
1053
1053
Object . entries ( OPTIONS )
1054
- . filter ( ( [ , descriptor ] ) => typeof descriptor . default !== 'undefined' )
1054
+ . filter ( ( [ , descriptor ] ) => descriptor . default != null )
1055
1055
. map ( ( [ k , d ] ) => [ k , d . default ] )
1056
1056
) ;
0 commit comments