Skip to content

Commit 0dafcad

Browse files
committed
fixed lint
1 parent d85e6e8 commit 0dafcad

File tree

2 files changed

+87
-177
lines changed

2 files changed

+87
-177
lines changed

index.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ function compression (options) {
8484
this.writeHead(this.statusCode)
8585
}
8686

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)
9088
}
9189

9290
res.end = function end (chunk, encoding) {
@@ -111,9 +109,7 @@ function compression (options) {
111109
ended = true
112110

113111
// 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()
117113
}
118114

119115
res.on = function on (type, listener) {
@@ -190,9 +186,7 @@ function compression (options) {
190186

191187
// compression stream
192188
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)
196190

197191
// add buffered listeners to stream
198192
addListeners(stream, stream.on, listeners)
@@ -241,9 +235,7 @@ function chunkLength (chunk, encoding) {
241235
return 0
242236
}
243237

244-
return !Buffer.isBuffer(chunk)
245-
? Buffer.byteLength(chunk, encoding)
246-
: chunk.length
238+
return !Buffer.isBuffer(chunk) ? Buffer.byteLength(chunk, encoding) : chunk.length
247239
}
248240

249241
/**
@@ -272,8 +264,7 @@ function shouldTransform (req, res) {
272264

273265
// Don't compress for Cache-Control: no-transform
274266
// https://tools.ietf.org/html/rfc7234#section-5.2.2.4
275-
return !cacheControl ||
276-
!cacheControlNoTransformRegExp.test(cacheControl)
267+
return !cacheControl || !cacheControlNoTransformRegExp.test(cacheControl)
277268
}
278269

279270
/**
@@ -282,7 +273,5 @@ function shouldTransform (req, res) {
282273
*/
283274

284275
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
288277
}

0 commit comments

Comments
 (0)