Skip to content

Commit 59e2975

Browse files
trivikrtargos
authored andcommitted
perf_hooks: use for...of
PR-URL: #31049 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 4a1cb3d commit 59e2975

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/perf_hooks.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,11 @@ class PerformanceObserver extends AsyncResource {
322322
disconnect() {
323323
const observerCountsGC = observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC];
324324
const types = this[kTypes];
325-
const keys = ObjectKeys(types);
326-
for (var n = 0; n < keys.length; n++) {
327-
const item = types[keys[n]];
325+
for (const key of ObjectKeys(types)) {
326+
const item = types[key];
328327
if (item) {
329328
L.remove(item);
330-
observerCounts[keys[n]]--;
329+
observerCounts[key]--;
331330
}
332331
}
333332
this[kTypes] = {};
@@ -353,8 +352,7 @@ class PerformanceObserver extends AsyncResource {
353352
this[kBuffer][kEntries] = [];
354353
L.init(this[kBuffer][kEntries]);
355354
this[kBuffering] = Boolean(options.buffered);
356-
for (var n = 0; n < entryTypes.length; n++) {
357-
const entryType = entryTypes[n];
355+
for (const entryType of entryTypes) {
358356
const list = getObserversList(entryType);
359357
if (this[kTypes][entryType]) continue;
360358
const item = { obs: this };

0 commit comments

Comments
 (0)