mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
events: make eventNames() use Reflect.ownKeys()
Use `Reflect.ownKeys()` instead of `Object.keys()` and `Object.getOwnPropertySymbols()`. PR-URL: https://github.com/nodejs/node/pull/5822 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
cdba9a6c02
commit
c1cd64481f
@ -437,12 +437,7 @@ function listenerCount(type) {
|
||||
}
|
||||
|
||||
EventEmitter.prototype.eventNames = function eventNames() {
|
||||
if (this._eventsCount > 0) {
|
||||
const events = this._events;
|
||||
return Object.keys(events).concat(
|
||||
Object.getOwnPropertySymbols(events));
|
||||
}
|
||||
return [];
|
||||
return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
|
||||
};
|
||||
|
||||
// About 1.5x faster than the two-arg version of Array#splice().
|
||||
|
Loading…
Reference in New Issue
Block a user