@@ -84,9 +84,7 @@ function compression (options) {
84
84
this . writeHead ( this . statusCode )
85
85
}
86
86
87
- return stream
88
- ? stream . write ( toBuffer ( chunk , encoding ) )
89
- : _write . call ( this , chunk , encoding )
87
+ return stream ? stream . write ( toBuffer ( chunk , encoding ) ) : _write . call ( this , chunk , encoding )
90
88
}
91
89
92
90
res . end = function end ( chunk , encoding ) {
@@ -111,9 +109,7 @@ function compression (options) {
111
109
ended = true
112
110
113
111
// write Buffer for Node.js 0.8
114
- return chunk
115
- ? stream . end ( toBuffer ( chunk , encoding ) )
116
- : stream . end ( )
112
+ return chunk ? stream . end ( toBuffer ( chunk , encoding ) ) : stream . end ( )
117
113
}
118
114
119
115
res . on = function on ( type , listener ) {
@@ -190,9 +186,7 @@ function compression (options) {
190
186
191
187
// compression stream
192
188
debug ( '%s compression' , method )
193
- stream = method === 'gzip'
194
- ? zlib . createGzip ( opts )
195
- : zlib . createDeflate ( opts )
189
+ stream = method === 'gzip' ? zlib . createGzip ( opts ) : zlib . createDeflate ( opts )
196
190
197
191
// add buffered listeners to stream
198
192
addListeners ( stream , stream . on , listeners )
@@ -241,9 +235,7 @@ function chunkLength (chunk, encoding) {
241
235
return 0
242
236
}
243
237
244
- return ! Buffer . isBuffer ( chunk )
245
- ? Buffer . byteLength ( chunk , encoding )
246
- : chunk . length
238
+ return ! Buffer . isBuffer ( chunk ) ? Buffer . byteLength ( chunk , encoding ) : chunk . length
247
239
}
248
240
249
241
/**
@@ -272,8 +264,7 @@ function shouldTransform (req, res) {
272
264
273
265
// Don't compress for Cache-Control: no-transform
274
266
// https://tools.ietf.org/html/rfc7234#section-5.2.2.4
275
- return ! cacheControl ||
276
- ! cacheControlNoTransformRegExp . test ( cacheControl )
267
+ return ! cacheControl || ! cacheControlNoTransformRegExp . test ( cacheControl )
277
268
}
278
269
279
270
/**
@@ -282,7 +273,5 @@ function shouldTransform (req, res) {
282
273
*/
283
274
284
275
function toBuffer ( chunk , encoding ) {
285
- return ! Buffer . isBuffer ( chunk )
286
- ? Buffer . from ( chunk , encoding )
287
- : chunk
276
+ return ! Buffer . isBuffer ( chunk ) ? Buffer . from ( chunk , encoding ) : chunk
288
277
}
0 commit comments