Skip to content

Commit

Permalink
perf(lib): replace accumulator spread with for...of
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Jan 8, 2025
1 parent d054374 commit 8f0f3f2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/messageFormatFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ const formatDate = require('./formatDate')
const colorizerFactory = require('pino-pretty').colorizerFactory

const messageFormatFactory = (levels, colors, useColors) => {
const customColors =
colors != null
? Object.entries(colors).reduce((colors, [level, color]) => {
colors.push([level, color])
return colors
}, [])
: undefined
let customColors
if (colors !== null) {
customColors = []
for (const entry of Object.entries(colors)) {
customColors.push(entry)
}
}
const colorizer = colorizerFactory(useColors, customColors)

const levelLookUp = {
Expand Down

0 comments on commit 8f0f3f2

Please sign in to comment.