summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuigi Pinca <luigipinca@gmail.com>2016-03-21 12:28:17 +0100
committerJames M Snell <jasnell@gmail.com>2016-04-26 12:16:31 -0700
commitc9628c55fa1c0feafe6366f045e869b3a3997971 (patch)
treeed6bc1d7f49f6cfb0cfaba61338a91560c9823e4 /lib
parent86ff8447f36588fc9cbc93b4576e8685a918b3aa (diff)
downloadnode-new-c9628c55fa1c0feafe6366f045e869b3a3997971.tar.gz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/events.js7
1 files changed, 1 insertions, 6 deletions
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().