From c9628c55fa1c0feafe6366f045e869b3a3997971 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Mon, 21 Mar 2016 12:28:17 +0100 Subject: 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(-) (limited to 'lib') diff --git a/lib/events.js b/lib/events.js index 669c0d70ea..36eb7835e4 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(). -- cgit v1.2.1