@@ -70,8 +70,6 @@ function compression (options) {
7070 threshold = 1024
7171 }
7272
73- function noop ( ) { }
74-
7573 return function compression ( req , res , next ) {
7674 var ended = false
7775 var length
@@ -92,25 +90,6 @@ function compression (options) {
9290 // proxy
9391
9492 res . write = function write ( chunk , encoding , callback ) {
95- if ( chunk === null ) {
96- // throw ERR_STREAM_NULL_VALUES
97- return _write . call ( this , chunk , encoding , callback )
98- } else if ( typeof chunk === 'string' || typeof chunk . fill === 'function' || isUint8Array ( chunk ) ) {
99- // noop
100- } else {
101- // throw ERR_INVALID_ARG_TYPE
102- return _write . call ( this , chunk , encoding , callback )
103- }
104-
105- if ( ! callback && typeof encoding === 'function' ) {
106- callback = encoding
107- encoding = undefined
108- }
109-
110- if ( typeof callback !== 'function' ) {
111- callback = noop
112- }
113-
11493 if ( res . destroyed || res . finished || ended ) {
11594 // HACK: node doesn't expose internal errors,
11695 // we need to fake response to throw underlying errors type
@@ -149,10 +128,6 @@ function compression (options) {
149128 }
150129 }
151130
152- if ( typeof callback !== 'function' ) {
153- callback = noop
154- }
155-
156131 if ( this . destroyed || this . finished || ended ) {
157132 this . finished = ended
158133 // throw ERR_STREAM_WRITE_AFTER_END or ERR_STREAM_ALREADY_FINISHED
@@ -375,14 +350,3 @@ function toBuffer (chunk, encoding) {
375350 ? chunk
376351 : Buffer . from ( chunk , encoding )
377352}
378-
379- /**
380- * Checks if the given argument is an instance of Uint8Array.
381- *
382- * @param {* } arg - The value to check.
383- * @returns {boolean } Returns `true` if the argument is an instance of Uint8Array, otherwise `false`.
384- * @private
385- */
386- function isUint8Array ( arg ) {
387- return arg && arg instanceof Uint8Array
388- }
0 commit comments