| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ba66b21 commit 398bdf4
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -341,19 +341,20 @@ class PerformanceObserver extends AsyncResource { | |||
| 341 | 341 | if (typeof options !== 'object' || options === null) { | |
| 342 | 342 | throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); | |
| 343 | 343 | } | |
| 344 | - if (!ArrayIsArray(options.entryTypes)) { | ||
| 345 | - throw new ERR_INVALID_OPT_VALUE('entryTypes', options); | ||
| 344 | + const { entryTypes } = options; | ||
| 345 | + if (!ArrayIsArray(entryTypes)) { | ||
| 346 | + throw new ERR_INVALID_OPT_VALUE('entryTypes', entryTypes); | ||
| 346 | 347 | } | |
| 347 | - const entryTypes = options.entryTypes.filter(filterTypes).map(mapTypes); | ||
| 348 | - if (entryTypes.length === 0) { | ||
| 348 | + const filteredEntryTypes = entryTypes.filter(filterTypes).map(mapTypes); | ||
| 349 | + if (filteredEntryTypes.length === 0) { | ||
| 349 | 350 | throw new ERR_VALID_PERFORMANCE_ENTRY_TYPE(); | |
| 350 | 351 | } | |
| 351 | 352 | this.disconnect(); | |
| 352 | 353 | const observerCountsGC = observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC]; | |
| 353 | 354 | this[kBuffer][kEntries] = []; | |
| 354 | 355 | L.init(this[kBuffer][kEntries]); | |
| 355 | 356 | this[kBuffering] = Boolean(options.buffered); | |
| 356 | - for (const entryType of entryTypes) { | ||
| 357 | + for (const entryType of filteredEntryTypes) { | ||
| 357 | 358 | const list = getObserversList(entryType); | |
| 358 | 359 | if (this[kTypes][entryType]) continue; | |
| 359 | 360 | const item = { obs: this }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,7 +58,7 @@ assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION], 0); | |||
| 58 | 58 | { | |
| 59 | 59 | code: 'ERR_INVALID_OPT_VALUE', | |
| 60 | 60 | name: 'TypeError', | |
| 61 | - message: 'The value "[object Object]" is invalid ' + | ||
| 61 | + message: `The value "${i}" is invalid ` + | ||
| 62 | 62 | 'for option "entryTypes"' | |
| 63 | 63 | }); | |
| 64 | 64 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments