Skip to content

Commit 5516b87

Browse files
committed
use object assign in params
1 parent 2e0c60b commit 5516b87

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,11 @@ function compression (options) {
5858
var optsBrotli = objectAssign({}, opts.brotli)
5959

6060
if (hasBrotliSupport) {
61-
if (optsBrotli.params === undefined) {
62-
optsBrotli.params = {}
63-
}
61+
var brotliParams = {}
62+
brotliParams[zlib.constants.BROTLI_PARAM_QUALITY] = 4
6463

6564
// set the default level to a reasonable value with balanced speed/ratio
66-
if (optsBrotli.params[zlib.constants.BROTLI_PARAM_QUALITY] === undefined) {
67-
optsBrotli.params[zlib.constants.BROTLI_PARAM_QUALITY] = 4
68-
}
65+
optsBrotli.params = Object.assign(brotliParams, optsBrotli.params)
6966
}
7067

7168
// options

0 commit comments

Comments
 (0)