From c1cd64481ff8801c8c400c99de9a5f2618dae5ea Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Mon, 21 Mar 2016 12:28:17 +0100 Subject: [PATCH] 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 Reviewed-By: Colin Ihrig --- lib/events.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/events.js b/lib/events.js index 669c0d70ea1c36..36eb7835e40ec0 100644 --- a/lib/events.js +++ b/lib/events.js @@ -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().