Skip to content

Commit 75d49f4

Browse files
committed
make minify() method async function
[BREAKING] drop support for Node.js < 7
1 parent f56b158 commit 75d49f4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@ module.exports = class CleanCssPromise extends CleanCss {
5656
super(options);
5757
}
5858

59-
minify(...args) {
59+
async minify(...args) {
6060
const argLen = args.length;
6161

6262
if (argLen === 0) {
6363
const error = new RangeError('Expected 1 or 2 arguments (<string|Object>[, <string>]), but got no arguments.');
6464
error.code = 'ERR_MISSING_ARGS';
6565

66-
return Promise.reject(error);
66+
throw error;
6767
}
6868

6969
if (argLen > 2) {
7070
const error = new RangeError(`Expected 1 or 2 arguments (<string|Object>[, <string>]), but got ${argLen} arguments.`);
7171
error.code = 'ERR_TOO_MANY_ARGS';
7272

73-
return Promise.reject(error);
73+
throw error;
7474
}
7575

7676
const [input, sourceMap] = args;
@@ -82,7 +82,7 @@ module.exports = class CleanCssPromise extends CleanCss {
8282
}.`);
8383
error.code = 'ERR_INVALID_ARG_TYPE';
8484

85-
return Promise.reject(error);
85+
throw error;
8686
}
8787

8888
if (typeof sourceMap !== 'string') {
@@ -91,7 +91,7 @@ module.exports = class CleanCssPromise extends CleanCss {
9191
}.`);
9292
error.code = 'ERR_INVALID_ARG_TYPE';
9393

94-
return Promise.reject(error);
94+
throw error;
9595
}
9696
}
9797

0 commit comments

Comments
 (0)