Skip to content

Commit

Permalink
perf: require needed lodash methods only
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Apr 2, 2018
1 parent b50cad8 commit 91065e4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/reporters/fancy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import chalk from 'chalk'
import figures from 'figures'
import _ from 'lodash'
import startCase from 'lodash/startCase'

const NS_SEPERATOR = chalk.blue(figures(' › '))

Expand All @@ -17,20 +17,18 @@ const ICONS = {
ready: figures('♥')
}

const pad = str => _.padEnd(str, 9)

export default class FancyReporter {
constructor (stream, options = {}) {
this.stream = stream || process.stderr
}

formatBadge (type, color = 'blue') {
return chalk['bg' + _.startCase(color)].black(` ${type.toUpperCase()} `) + ' '
return chalk['bg' + startCase(color)].black(` ${type.toUpperCase()} `) + ' '
}

formatTag (type, color = 'blue') {
const icon = ICONS[type] || ICONS.default
return chalk[color](pad(`${icon} ${type.toLowerCase()}`)) + ' '
return chalk[color](`${icon} ${type.toLowerCase()}`) + ' '
}

clear () {
Expand Down

0 comments on commit 91065e4

Please sign in to comment.