@@ -203,7 +203,7 @@ EventEmitter.init = function(opts) {
203
203
this . _maxListeners = this . _maxListeners || undefined ;
204
204
205
205
206
- if ( opts && opts . captureRejections ) {
206
+ if ( opts ? .captureRejections ) {
207
207
if ( typeof opts . captureRejections !== 'boolean' ) {
208
208
throw new ERR_INVALID_ARG_TYPE ( 'options.captureRejections' ,
209
209
'boolean' , opts . captureRejections ) ;
@@ -709,9 +709,9 @@ function getEventListeners(emitterOrTarget, type) {
709
709
}
710
710
711
711
async function once ( emitter , name , options = { } ) {
712
- const signal = options ? options . signal : undefined ;
712
+ const signal = options ? .signal ;
713
713
validateAbortSignal ( signal , 'options.signal' ) ;
714
- if ( signal && signal . aborted )
714
+ if ( signal ? .aborted )
715
715
throw lazyDOMException ( 'The operation was aborted' , 'AbortError' ) ;
716
716
return new Promise ( ( resolve , reject ) => {
717
717
const errorListener = ( err ) => {
@@ -791,7 +791,7 @@ function eventTargetAgnosticRemoveListener(emitter, name, listener, flags) {
791
791
792
792
function eventTargetAgnosticAddListener ( emitter , name , listener , flags ) {
793
793
if ( typeof emitter . on === 'function' ) {
794
- if ( flags && flags . once ) {
794
+ if ( flags ? .once ) {
795
795
emitter . once ( name , listener ) ;
796
796
} else {
797
797
emitter . on ( name , listener ) ;
@@ -806,9 +806,9 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
806
806
}
807
807
808
808
function on ( emitter , event , options ) {
809
- const { signal } = { ... options } ;
809
+ const signal = options ?. signal ;
810
810
validateAbortSignal ( signal , 'options.signal' ) ;
811
- if ( signal && signal . aborted ) {
811
+ if ( signal ? .aborted ) {
812
812
throw lazyDOMException ( 'The operation was aborted' , 'AbortError' ) ;
813
813
}
814
814
0 commit comments