@@ -35,7 +35,11 @@ const {
35
35
} = require ( 'internal/errors' ) ;
36
36
const { validateObject, validateString } = require ( 'internal/validators' ) ;
37
37
38
- const { customInspectSymbol, kEnumerableProperty } = require ( 'internal/util' ) ;
38
+ const {
39
+ customInspectSymbol,
40
+ kEmptyObject,
41
+ kEnumerableProperty,
42
+ } = require ( 'internal/util' ) ;
39
43
const { inspect } = require ( 'util' ) ;
40
44
41
45
const kIsEventTarget = SymbolFor ( 'nodejs.event_target' ) ;
@@ -455,7 +459,7 @@ class EventTarget {
455
459
* signal?: AbortSignal
456
460
* }} [options]
457
461
*/
458
- addEventListener ( type , listener , options = { } ) {
462
+ addEventListener ( type , listener , options = kEmptyObject ) {
459
463
if ( ! isEventTarget ( this ) )
460
464
throw new ERR_INVALID_THIS ( 'EventTarget' ) ;
461
465
if ( arguments . length < 2 )
@@ -542,7 +546,7 @@ class EventTarget {
542
546
* capture?: boolean,
543
547
* }} [options]
544
548
*/
545
- removeEventListener ( type , listener , options = { } ) {
549
+ removeEventListener ( type , listener , options = kEmptyObject ) {
546
550
if ( ! isEventTarget ( this ) )
547
551
throw new ERR_INVALID_THIS ( 'EventTarget' ) ;
548
552
if ( ! shouldAddListener ( listener ) )
@@ -870,7 +874,7 @@ function validateEventListenerOptions(options) {
870
874
return { capture : options } ;
871
875
872
876
if ( options === null )
873
- return { } ;
877
+ return kEmptyObject ;
874
878
validateObject ( options , 'options' , {
875
879
allowArray : true , allowFunction : true ,
876
880
} ) ;
0 commit comments