@@ -203,7 +203,7 @@ EventEmitter.init = function(opts) {
203203this . _maxListeners = this . _maxListeners || undefined ;
204204
205205
206- if ( opts && opts . captureRejections ) {
206+ if ( opts ? .captureRejections ) {
207207if ( typeof opts . captureRejections !== 'boolean' ) {
208208throw new ERR_INVALID_ARG_TYPE ( 'options.captureRejections' ,
209209'boolean' , opts . captureRejections ) ;
@@ -709,9 +709,9 @@ function getEventListeners(emitterOrTarget, type) {
709709}
710710
711711async function once ( emitter , name , options = { } ) {
712- const signal = options ? options . signal : undefined ;
712+ const signal = options ? .signal ;
713713validateAbortSignal ( signal , 'options.signal' ) ;
714- if ( signal && signal . aborted )
714+ if ( signal ? .aborted )
715715throw lazyDOMException ( 'The operation was aborted' , 'AbortError' ) ;
716716return new Promise ( ( resolve , reject ) => {
717717const errorListener = ( err ) => {
@@ -765,7 +765,7 @@ function eventTargetAgnosticRemoveListener(emitter, name, listener, flags) {
765765
766766function eventTargetAgnosticAddListener ( emitter , name , listener , flags ) {
767767if ( typeof emitter . on === 'function' ) {
768- if ( flags && flags . once ) {
768+ if ( flags ? .once ) {
769769emitter . once ( name , listener ) ;
770770} else {
771771emitter . on ( name , listener ) ;
@@ -780,9 +780,9 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
780780}
781781
782782function on ( emitter , event , options ) {
783- const { signal } = { ... options } ;
783+ const signal = options ?. signal ;
784784validateAbortSignal ( signal , 'options.signal' ) ;
785- if ( signal && signal . aborted ) {
785+ if ( signal ? .aborted ) {
786786throw lazyDOMException ( 'The operation was aborted' , 'AbortError' ) ;
787787}
788788
0 commit comments