Skip to content

Commit

Permalink
fix: replace Object.values for node 6.x compability (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
eleith authored and pi0 committed Aug 24, 2018
1 parent 0346c33 commit d004bb6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const defaults = {
stream: null,
};

const hasRunning = () => Object.values(sharedState).find((s) => s.isRunning);
const hasRunning = () =>
Object.keys(sharedState)
.map((e) => sharedState[e])
.find((s) => s.isRunning);

const $logUpdate = logUpdate.create(process.stderr, {
showCursor: false,
Expand Down Expand Up @@ -147,8 +150,9 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {

const columns = this.stream.columns || 80;

const stateLines = _.sortBy(Object.keys(sharedState), (n) => n).map(
(name) => {
const stateLines = _
.sortBy(Object.keys(sharedState), (n) => n)
.map((name) => {
const state = sharedState[name];
const color = colorize(state.color);

Expand All @@ -170,8 +174,7 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
? chalk.grey(elipsesLeft(formatRequest(state.request), columns - 2))
: ''
}\n`;
}
);
});

if (hasRunning()) {
const title = chalk.underline.blue('Compiling');
Expand Down

0 comments on commit d004bb6

Please sign in to comment.