@@ -23,8 +23,6 @@ var vary = require('vary')
2323var zlib = require ( 'zlib' )
2424var ServerResponse = require ( 'http' ) . ServerResponse
2525
26- var isOldRuntime = / ^ v 0 \. 8 \. / . test ( process . version )
27-
2826/**
2927 * Module exports.
3028 */
@@ -37,10 +35,7 @@ module.exports.filter = shouldCompress
3735 * @private
3836 */
3937var cacheControlNoTransformRegExp = / (?: ^ | , ) \s * ?n o - t r a n s f o r m \s * ?(?: , | $ ) /
40- var hasUint8Array = ( typeof Uint8Array === 'function' )
41- function isUint8Array ( arg ) {
42- return hasUint8Array && arg && ( arg instanceof Uint8Array || arg . toString ( ) === '[object Uint8Array]' )
43- }
38+
4439var SUPPORTED_ENCODING = [ 'br' , 'gzip' , 'deflate' , 'identity' ]
4540var PREFERRED_ENCODING = [ 'br' , 'gzip' ]
4641
@@ -134,9 +129,6 @@ function compression (options) {
134129
135130 if ( chunk ) {
136131 chunk = toBuffer ( chunk , encoding )
137- if ( isOldRuntime && stream ) {
138- encoding = callback
139- }
140132 }
141133
142134 return stream
@@ -183,9 +175,6 @@ function compression (options) {
183175
184176 if ( chunk ) {
185177 chunk = toBuffer ( chunk , encoding )
186- if ( isOldRuntime && stream ) {
187- encoding = callback
188- }
189178 }
190179
191180 // write Buffer for Node.js 0.8
@@ -370,3 +359,14 @@ function toBuffer (chunk, encoding) {
370359 ? chunk
371360 : Buffer . from ( chunk , encoding )
372361}
362+
363+ /**
364+ * Checks if the given argument is an instance of Uint8Array.
365+ *
366+ * @param {* } arg - The value to check.
367+ * @returns {boolean } Returns `true` if the argument is an instance of Uint8Array, otherwise `false`.
368+ * @private
369+ */
370+ function isUint8Array ( arg ) {
371+ return arg && arg instanceof Uint8Array
372+ }
0 commit comments