@@ -706,57 +706,72 @@ Zlib.prototype.params = function params(level, strategy, callback) {
706706// generic zlib
707707// minimal 2-byte header
708708function Deflate ( opts ) {
709- if ( ! ( this instanceof Deflate ) )
709+ if ( ! ( this instanceof Deflate ) ) {
710+ process . emitWarning ( `Initializing Deflate without "new" qualifier is deprecated` , 'DEP0000' ) ;
710711 return new Deflate ( opts ) ;
712+ }
711713 ReflectApply ( Zlib , this , [ opts , DEFLATE ] ) ;
712714}
713715ObjectSetPrototypeOf ( Deflate . prototype , Zlib . prototype ) ;
714716ObjectSetPrototypeOf ( Deflate , Zlib ) ;
715717
716718function Inflate ( opts ) {
717- if ( ! ( this instanceof Inflate ) )
719+ if ( ! ( this instanceof Inflate ) ) {
720+ process . emitWarning ( `Initializing Inflate without "new" qualifier is deprecated` , 'DEP0000' ) ;
718721 return new Inflate ( opts ) ;
722+ }
719723 ReflectApply ( Zlib , this , [ opts , INFLATE ] ) ;
720724}
721725ObjectSetPrototypeOf ( Inflate . prototype , Zlib . prototype ) ;
722726ObjectSetPrototypeOf ( Inflate , Zlib ) ;
723727
724728function Gzip ( opts ) {
725- if ( ! ( this instanceof Gzip ) )
729+ if ( ! ( this instanceof Gzip ) ) {
730+ process . emitWarning ( `Initializing Inflate without "new" qualifier is deprecated` , 'DEP0000' ) ;
726731 return new Gzip ( opts ) ;
732+ }
727733 ReflectApply ( Zlib , this , [ opts , GZIP ] ) ;
728734}
729735ObjectSetPrototypeOf ( Gzip . prototype , Zlib . prototype ) ;
730736ObjectSetPrototypeOf ( Gzip , Zlib ) ;
731737
732738function Gunzip ( opts ) {
733- if ( ! ( this instanceof Gunzip ) )
739+ if ( ! ( this instanceof Gunzip ) ) {
740+ process . emitWarning ( `Initializing Gunzip without "new" qualifier is deprecated` , 'DEP0000' ) ;
734741 return new Gunzip ( opts ) ;
742+ }
735743 ReflectApply ( Zlib , this , [ opts , GUNZIP ] ) ;
736744}
737745ObjectSetPrototypeOf ( Gunzip . prototype , Zlib . prototype ) ;
738746ObjectSetPrototypeOf ( Gunzip , Zlib ) ;
739747
740748function DeflateRaw ( opts ) {
741749 if ( opts && opts . windowBits === 8 ) opts . windowBits = 9 ;
742- if ( ! ( this instanceof DeflateRaw ) )
750+ if ( ! ( this instanceof DeflateRaw ) ) {
751+ process . emitWarning ( `Initializing DeflateRaw without "new" qualifier is deprecated` , 'DEP0000' ) ;
743752 return new DeflateRaw ( opts ) ;
753+ }
744754 ReflectApply ( Zlib , this , [ opts , DEFLATERAW ] ) ;
745755}
746756ObjectSetPrototypeOf ( DeflateRaw . prototype , Zlib . prototype ) ;
747757ObjectSetPrototypeOf ( DeflateRaw , Zlib ) ;
748758
749759function InflateRaw ( opts ) {
750- if ( ! ( this instanceof InflateRaw ) )
760+ if ( ! ( this instanceof InflateRaw ) ) {
761+ process . emitWarning ( `Initializing InflateRaw without "new" qualifier is deprecated` , 'DEP0000' ) ;
751762 return new InflateRaw ( opts ) ;
763+ }
752764 ReflectApply ( Zlib , this , [ opts , INFLATERAW ] ) ;
753765}
754766ObjectSetPrototypeOf ( InflateRaw . prototype , Zlib . prototype ) ;
755767ObjectSetPrototypeOf ( InflateRaw , Zlib ) ;
756768
757769function Unzip ( opts ) {
758- if ( ! ( this instanceof Unzip ) )
770+ if ( ! ( this instanceof Unzip ) ) {
771+ process . emitWarning ( `Initializing Unzip without "new" qualifier is deprecated` , 'DEP0000' ) ;
759772 return new Unzip ( opts ) ;
773+
774+ }
760775 ReflectApply ( Zlib , this , [ opts , UNZIP ] ) ;
761776}
762777ObjectSetPrototypeOf ( Unzip . prototype , Zlib . prototype ) ;
@@ -831,16 +846,21 @@ ObjectSetPrototypeOf(Brotli.prototype, Zlib.prototype);
831846ObjectSetPrototypeOf ( Brotli , Zlib ) ;
832847
833848function BrotliCompress ( opts ) {
834- if ( ! ( this instanceof BrotliCompress ) )
849+ if ( ! ( this instanceof BrotliCompress ) ) {
850+ process . emitWarning ( `Initializing BrotliCompress without "new" qualifier is deprecated` , 'DEP0000' ) ;
835851 return new BrotliCompress ( opts ) ;
852+ }
836853 ReflectApply ( Brotli , this , [ opts , BROTLI_ENCODE ] ) ;
837854}
838855ObjectSetPrototypeOf ( BrotliCompress . prototype , Brotli . prototype ) ;
839856ObjectSetPrototypeOf ( BrotliCompress , Brotli ) ;
840857
841858function BrotliDecompress ( opts ) {
842- if ( ! ( this instanceof BrotliDecompress ) )
859+ if ( ! ( this instanceof BrotliDecompress ) ) {
860+ process . emitWarning ( `Initializing BrotliDecompress without "new" qualifier is deprecated` , 'DEP0000' ) ;
843861 return new BrotliDecompress ( opts ) ;
862+
863+ }
844864 ReflectApply ( Brotli , this , [ opts , BROTLI_DECODE ] ) ;
845865}
846866ObjectSetPrototypeOf ( BrotliDecompress . prototype , Brotli . prototype ) ;
0 commit comments