@@ -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 ) => {
@@ -765,7 +765,7 @@ function eventTargetAgnosticRemoveListener(emitter, name, listener, flags) {
765
765
766
766
function eventTargetAgnosticAddListener ( emitter , name , listener , flags ) {
767
767
if ( typeof emitter . on === 'function' ) {
768
- if ( flags && flags . once ) {
768
+ if ( flags ? .once ) {
769
769
emitter . once ( name , listener ) ;
770
770
} else {
771
771
emitter . on ( name , listener ) ;
@@ -780,9 +780,9 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
780
780
}
781
781
782
782
function on ( emitter , event , options ) {
783
- const { signal } = { ... options } ;
783
+ const signal = options ?. signal ;
784
784
validateAbortSignal ( signal , 'options.signal' ) ;
785
- if ( signal && signal . aborted ) {
785
+ if ( signal ? .aborted ) {
786
786
throw lazyDOMException ( 'The operation was aborted' , 'AbortError' ) ;
787
787
}
788
788
0 commit comments