Skip to content

Commit

Permalink
fix: avoid object.values for node < 7 compability
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Dec 11, 2018
1 parent 0ca3722 commit 83fcd06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ProgressPlugin } from 'webpack';
import env from 'std-env';
import prettyTime from 'pretty-time';

import { startCase, shortenPath } from './utils';
import { startCase, shortenPath, objectValues } from './utils';

import * as reporters from './reporters'; // eslint-disable-line import/no-namespace
import { parseRequest, hook } from './utils/webpack';
Expand Down Expand Up @@ -101,15 +101,15 @@ export default class WebpackBarPlugin extends ProgressPlugin {
}

get hasRunning() {
return Object.values(this.states).some((state) => !state.done);
return objectValues(this.states).some((state) => !state.done);
}

get hasErrors() {
return Object.values(this.states).some((state) => state.hasErrors);
return objectValues(this.states).some((state) => state.hasErrors);
}

get statesArray() {
return Object.values(this.states).sort((s1, s2) =>
return objectValues(this.states).sort((s1, s2) =>
s1.name.localeCompare(s2.name)
);
}
Expand Down
4 changes: 4 additions & 0 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ export function shortenPath(path = '') {
const cwd = process.cwd() + sep;
return path.replace(cwd, '');
}

export function objectValues(obj) {
return Object.keys(obj).map((key) => obj[key]);
}

0 comments on commit 83fcd06

Please sign in to comment.