Skip to content

Commit

Permalink
perf_hooks: use for...of
Browse files Browse the repository at this point in the history
PR-URL: #31049
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
trivikr authored and targos committed Jan 6, 2020
1 parent 4b2d8df commit ae58c97
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/perf_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {};
Expand All @@ -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 };
Expand Down

0 comments on commit ae58c97

Please sign in to comment.