@@ -706,57 +706,72 @@ Zlib.prototype.params = function params(level, strategy, callback) {
706
706
// generic zlib
707
707
// minimal 2-byte header
708
708
function Deflate ( opts ) {
709
- if ( ! ( this instanceof Deflate ) )
709
+ if ( ! ( this instanceof Deflate ) ) {
710
+ process . emitWarning ( `Initializing Deflate without "new" qualifier is deprecated` , 'DEP0000' ) ;
710
711
return new Deflate ( opts ) ;
712
+ }
711
713
ReflectApply ( Zlib , this , [ opts , DEFLATE ] ) ;
712
714
}
713
715
ObjectSetPrototypeOf ( Deflate . prototype , Zlib . prototype ) ;
714
716
ObjectSetPrototypeOf ( Deflate , Zlib ) ;
715
717
716
718
function Inflate ( opts ) {
717
- if ( ! ( this instanceof Inflate ) )
719
+ if ( ! ( this instanceof Inflate ) ) {
720
+ process . emitWarning ( `Initializing Inflate without "new" qualifier is deprecated` , 'DEP0000' ) ;
718
721
return new Inflate ( opts ) ;
722
+ }
719
723
ReflectApply ( Zlib , this , [ opts , INFLATE ] ) ;
720
724
}
721
725
ObjectSetPrototypeOf ( Inflate . prototype , Zlib . prototype ) ;
722
726
ObjectSetPrototypeOf ( Inflate , Zlib ) ;
723
727
724
728
function Gzip ( opts ) {
725
- if ( ! ( this instanceof Gzip ) )
729
+ if ( ! ( this instanceof Gzip ) ) {
730
+ process . emitWarning ( `Initializing Inflate without "new" qualifier is deprecated` , 'DEP0000' ) ;
726
731
return new Gzip ( opts ) ;
732
+ }
727
733
ReflectApply ( Zlib , this , [ opts , GZIP ] ) ;
728
734
}
729
735
ObjectSetPrototypeOf ( Gzip . prototype , Zlib . prototype ) ;
730
736
ObjectSetPrototypeOf ( Gzip , Zlib ) ;
731
737
732
738
function Gunzip ( opts ) {
733
- if ( ! ( this instanceof Gunzip ) )
739
+ if ( ! ( this instanceof Gunzip ) ) {
740
+ process . emitWarning ( `Initializing Gunzip without "new" qualifier is deprecated` , 'DEP0000' ) ;
734
741
return new Gunzip ( opts ) ;
742
+ }
735
743
ReflectApply ( Zlib , this , [ opts , GUNZIP ] ) ;
736
744
}
737
745
ObjectSetPrototypeOf ( Gunzip . prototype , Zlib . prototype ) ;
738
746
ObjectSetPrototypeOf ( Gunzip , Zlib ) ;
739
747
740
748
function DeflateRaw ( opts ) {
741
749
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' ) ;
743
752
return new DeflateRaw ( opts ) ;
753
+ }
744
754
ReflectApply ( Zlib , this , [ opts , DEFLATERAW ] ) ;
745
755
}
746
756
ObjectSetPrototypeOf ( DeflateRaw . prototype , Zlib . prototype ) ;
747
757
ObjectSetPrototypeOf ( DeflateRaw , Zlib ) ;
748
758
749
759
function InflateRaw ( opts ) {
750
- if ( ! ( this instanceof InflateRaw ) )
760
+ if ( ! ( this instanceof InflateRaw ) ) {
761
+ process . emitWarning ( `Initializing InflateRaw without "new" qualifier is deprecated` , 'DEP0000' ) ;
751
762
return new InflateRaw ( opts ) ;
763
+ }
752
764
ReflectApply ( Zlib , this , [ opts , INFLATERAW ] ) ;
753
765
}
754
766
ObjectSetPrototypeOf ( InflateRaw . prototype , Zlib . prototype ) ;
755
767
ObjectSetPrototypeOf ( InflateRaw , Zlib ) ;
756
768
757
769
function Unzip ( opts ) {
758
- if ( ! ( this instanceof Unzip ) )
770
+ if ( ! ( this instanceof Unzip ) ) {
771
+ process . emitWarning ( `Initializing Unzip without "new" qualifier is deprecated` , 'DEP0000' ) ;
759
772
return new Unzip ( opts ) ;
773
+
774
+ }
760
775
ReflectApply ( Zlib , this , [ opts , UNZIP ] ) ;
761
776
}
762
777
ObjectSetPrototypeOf ( Unzip . prototype , Zlib . prototype ) ;
@@ -831,16 +846,21 @@ ObjectSetPrototypeOf(Brotli.prototype, Zlib.prototype);
831
846
ObjectSetPrototypeOf ( Brotli , Zlib ) ;
832
847
833
848
function BrotliCompress ( opts ) {
834
- if ( ! ( this instanceof BrotliCompress ) )
849
+ if ( ! ( this instanceof BrotliCompress ) ) {
850
+ process . emitWarning ( `Initializing BrotliCompress without "new" qualifier is deprecated` , 'DEP0000' ) ;
835
851
return new BrotliCompress ( opts ) ;
852
+ }
836
853
ReflectApply ( Brotli , this , [ opts , BROTLI_ENCODE ] ) ;
837
854
}
838
855
ObjectSetPrototypeOf ( BrotliCompress . prototype , Brotli . prototype ) ;
839
856
ObjectSetPrototypeOf ( BrotliCompress , Brotli ) ;
840
857
841
858
function BrotliDecompress ( opts ) {
842
- if ( ! ( this instanceof BrotliDecompress ) )
859
+ if ( ! ( this instanceof BrotliDecompress ) ) {
860
+ process . emitWarning ( `Initializing BrotliDecompress without "new" qualifier is deprecated` , 'DEP0000' ) ;
843
861
return new BrotliDecompress ( opts ) ;
862
+
863
+ }
844
864
ReflectApply ( Brotli , this , [ opts , BROTLI_DECODE ] ) ;
845
865
}
846
866
ObjectSetPrototypeOf ( BrotliDecompress . prototype , Brotli . prototype ) ;
0 commit comments