@@ -32,40 +32,40 @@ const events = require('events');
3232 for (let i = 0; i < 10; i++) {
3333 e.on('default', common.mustNotCall());
3434 }
35- assert.ok(!e._events.default.hasOwnProperty( 'warned'));
35+ assert.ok(!Object.hasOwn( e._events.default, 'warned'));
3636 e.on('default', common.mustNotCall());
3737 assert.ok(e._events.default.warned);
3838
3939 // symbol
4040 const symbol = Symbol('symbol');
4141 e.setMaxListeners(1);
4242 e.on(symbol, common.mustNotCall());
43- assert.ok(!e._events[symbol].hasOwnProperty( 'warned'));
43+ assert.ok(!Object.hasOwn( e._events[symbol], 'warned'));
4444 e.on(symbol, common.mustNotCall());
45- assert.ok(e._events[symbol].hasOwnProperty( 'warned'));
45+ assert.ok(Object.hasOwn( e._events[symbol], 'warned'));
4646
4747 // specific
4848 e.setMaxListeners(5);
4949 for (let i = 0; i < 5; i++) {
5050 e.on('specific', common.mustNotCall());
5151 }
52- assert.ok(!e._events.specific.hasOwnProperty( 'warned'));
52+ assert.ok(!Object.hasOwn( e._events.specific, 'warned'));
5353 e.on('specific', common.mustNotCall());
5454 assert.ok(e._events.specific.warned);
5555
5656 // only one
5757 e.setMaxListeners(1);
5858 e.on('only one', common.mustNotCall());
59- assert.ok(!e._events['only one'].hasOwnProperty( 'warned'));
59+ assert.ok(!Object.hasOwn( e._events['only one'], 'warned'));
6060 e.on('only one', common.mustNotCall());
61- assert.ok(e._events['only one'].hasOwnProperty( 'warned'));
61+ assert.ok(Object.hasOwn( e._events['only one'], 'warned'));
6262
6363 // unlimited
6464 e.setMaxListeners(0);
6565 for (let i = 0; i < 1000; i++) {
6666 e.on('unlimited', common.mustNotCall());
6767 }
68- assert.ok(!e._events.unlimited.hasOwnProperty( 'warned'));
68+ assert.ok(!Object.hasOwn( e._events.unlimited, 'warned'));
6969}
7070
7171// process-wide
@@ -76,16 +76,16 @@ const events = require('events');
7676 for (let i = 0; i < 42; ++i) {
7777 e.on('fortytwo', common.mustNotCall());
7878 }
79- assert.ok(!e._events.fortytwo.hasOwnProperty( 'warned'));
79+ assert.ok(!Object.hasOwn( e._events.fortytwo, 'warned'));
8080 e.on('fortytwo', common.mustNotCall());
81- assert.ok(e._events.fortytwo.hasOwnProperty( 'warned'));
81+ assert.ok(Object.hasOwn( e._events.fortytwo, 'warned'));
8282 delete e._events.fortytwo.warned;
8383
8484 events.EventEmitter.defaultMaxListeners = 44;
8585 e.on('fortytwo', common.mustNotCall());
86- assert.ok(!e._events.fortytwo.hasOwnProperty( 'warned'));
86+ assert.ok(!Object.hasOwn( e._events.fortytwo, 'warned'));
8787 e.on('fortytwo', common.mustNotCall());
88- assert.ok(e._events.fortytwo.hasOwnProperty( 'warned'));
88+ assert.ok(Object.hasOwn( e._events.fortytwo, 'warned'));
8989}
9090
9191// But _maxListeners still has precedence over defaultMaxListeners
@@ -94,9 +94,9 @@ const events = require('events');
9494 const e = new events.EventEmitter();
9595 e.setMaxListeners(1);
9696 e.on('uno', common.mustNotCall());
97- assert.ok(!e._events.uno.hasOwnProperty( 'warned'));
97+ assert.ok(!Object.hasOwn( e._events.uno, 'warned'));
9898 e.on('uno', common.mustNotCall());
99- assert.ok(e._events.uno.hasOwnProperty( 'warned'));
99+ assert.ok(Object.hasOwn( e._events.uno, 'warned'));
100100
101101 // chainable
102102 assert.strictEqual(e, e.setMaxListeners(1));
0 commit comments