From ae58c9709b367cf88c4a5b153aa76b296800472d Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Fri, 20 Dec 2019 19:25:28 -0800 Subject: [PATCH] perf_hooks: use for...of PR-URL: https://github.com/nodejs/node/pull/31049 Reviewed-By: James M Snell Reviewed-By: Rich Trott --- lib/perf_hooks.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 3fb06f4e93dfa1..e04e8e02eca61d 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -320,12 +320,11 @@ class PerformanceObserver extends AsyncResource { disconnect() { const observerCountsGC = observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC]; const types = this[kTypes]; - const keys = ObjectKeys(types); - for (var n = 0; n < keys.length; n++) { - const item = types[keys[n]]; + for (const key of ObjectKeys(types)) { + const item = types[key]; if (item) { L.remove(item); - observerCounts[keys[n]]--; + observerCounts[key]--; } } this[kTypes] = {}; @@ -351,8 +350,7 @@ class PerformanceObserver extends AsyncResource { this[kBuffer][kEntries] = []; L.init(this[kBuffer][kEntries]); this[kBuffering] = Boolean(options.buffered); - for (var n = 0; n < entryTypes.length; n++) { - const entryType = entryTypes[n]; + for (const entryType of entryTypes) { const list = getObserversList(entryType); if (this[kTypes][entryType]) continue; const item = { obs: this };