Skip to content

Commit 9a25d7a

Browse files
committed
refactor: more functional
1 parent 173dc0a commit 9a25d7a

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/index.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,19 +205,13 @@ class Saturn {
205205
* @param {Array<object>} logs
206206
*/
207207
_matchLogsWithPerformanceMetrics (logs) {
208-
const logsToReport = []
209-
210-
for (const log of logs) {
211-
const metrics = this._getPerformanceMetricsForLog(log)
212-
213-
if (!metrics.isFromBrowserCache) {
214-
delete metrics.isFromBrowserCache
215-
Object.assign(log, metrics)
216-
logsToReport.push(log)
217-
}
218-
}
219-
220-
return logsToReport
208+
return logs
209+
.map(log => ({ ...log, ...this._getPerformanceMetricsForLog(log) }))
210+
.filter(log => !log.isFromBrowserCache)
211+
.map(log => {
212+
const { isFromBrowserCache: _, ...cleanLog } = log
213+
return cleanLog
214+
})
221215
}
222216

223217
/**

0 commit comments

Comments
 (0)