Skip to content

Commit 83fcd06

Browse files
committed
fix: avoid object.values for node < 7 compability
1 parent 0ca3722 commit 83fcd06

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/plugin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ProgressPlugin } from 'webpack';
22
import env from 'std-env';
33
import prettyTime from 'pretty-time';
44

5-
import { startCase, shortenPath } from './utils';
5+
import { startCase, shortenPath, objectValues } from './utils';
66

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

103103
get hasRunning() {
104-
return Object.values(this.states).some((state) => !state.done);
104+
return objectValues(this.states).some((state) => !state.done);
105105
}
106106

107107
get hasErrors() {
108-
return Object.values(this.states).some((state) => state.hasErrors);
108+
return objectValues(this.states).some((state) => state.hasErrors);
109109
}
110110

111111
get statesArray() {
112-
return Object.values(this.states).sort((s1, s2) =>
112+
return objectValues(this.states).sort((s1, s2) =>
113113
s1.name.localeCompare(s2.name)
114114
);
115115
}

src/utils/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ export function shortenPath(path = '') {
4141
const cwd = process.cwd() + sep;
4242
return path.replace(cwd, '');
4343
}
44+
45+
export function objectValues(obj) {
46+
return Object.keys(obj).map((key) => obj[key]);
47+
}

0 commit comments

Comments
 (0)