@@ -177,7 +177,7 @@ function toRecord(value: string): Record<string, any> {
177177 const keyValuePairs = value . split ( ',' ) ;
178178 for ( const keyValue of keyValuePairs ) {
179179 const [ key , value ] = keyValue . split ( ':' ) ;
180- if ( typeof value === 'undefined' ) {
180+ if ( value == null ) {
181181 throw new MongoParseError ( 'Cannot have undefined values in key value pairs' ) ;
182182 }
183183 try {
@@ -219,7 +219,7 @@ export function parseOptions(
219219 mongoClient : MongoClient | MongoClientOptions | undefined = undefined ,
220220 options : MongoClientOptions = { }
221221) : MongoOptions {
222- if ( typeof mongoClient !== 'undefined' && ! ( mongoClient instanceof MongoClient ) ) {
222+ if ( mongoClient != null && ! ( mongoClient instanceof MongoClient ) ) {
223223 options = mongoClient ;
224224 mongoClient = undefined ;
225225 }
@@ -284,7 +284,7 @@ export function parseOptions(
284284 }
285285
286286 const objectOptions = new CaseInsensitiveMap (
287- Object . entries ( options ) . filter ( ( [ , v ] ) => ( v ?? null ) != = null )
287+ Object . entries ( options ) . filter ( ( [ , v ] ) => v ! = null )
288288 ) ;
289289
290290 const allOptions = new CaseInsensitiveMap ( ) ;
@@ -418,7 +418,7 @@ function setOption(
418418 mongoOptions [ name ] = getUint ( name , values [ 0 ] ) ;
419419 break ;
420420 case 'string' :
421- if ( values [ 0 ] === undefined ) {
421+ if ( values [ 0 ] == null ) {
422422 break ;
423423 }
424424 mongoOptions [ name ] = String ( values [ 0 ] ) ;
@@ -1051,6 +1051,6 @@ export const OPTIONS = {
10511051
10521052export const DEFAULT_OPTIONS = new CaseInsensitiveMap (
10531053 Object . entries ( OPTIONS )
1054- . filter ( ( [ , descriptor ] ) => typeof descriptor . default !== 'undefined' )
1054+ . filter ( ( [ , descriptor ] ) => descriptor . default != null )
10551055 . map ( ( [ k , d ] ) => [ k , d . default ] )
10561056) ;
0 commit comments