Skip to content

Commit b6f74b0

Browse files
rchouguledanielleadams
authored andcommitted
zlib: refactor to use primordial instead of <string>.startsWith
PR-URL: #36718 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Pooja D P <[email protected]>
1 parent d70824f commit b6f74b0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎lib/zlib.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const{
3737
ObjectKeys,
3838
ObjectSetPrototypeOf,
3939
ReflectApply,
40+
StringPrototypeStartsWith,
4041
Symbol,
4142
TypedArrayPrototypeFill,
4243
Uint32Array,
@@ -786,7 +787,9 @@ function createConvenienceMethod(ctor, sync){
786787

787788
constkMaxBrotliParam=MathMax(...ArrayPrototypeMap(
788789
ObjectKeys(constants),
789-
(key)=>(key.startsWith('BROTLI_PARAM_') ? constants[key] : 0)
790+
(key)=>(StringPrototypeStartsWith(key,'BROTLI_PARAM_') ?
791+
constants[key] :
792+
0)
790793
));
791794

792795
constbrotliInitParamsArray=newUint32Array(kMaxBrotliParam+1);
@@ -927,7 +930,7 @@ ObjectDefineProperties(module.exports,{
927930
// These should be considered deprecated
928931
// expose all the zlib constants
929932
for(constbkeyofObjectKeys(constants)){
930-
if(bkey.startsWith('BROTLI'))continue;
933+
if(StringPrototypeStartsWith(bkey,'BROTLI'))continue;
931934
ObjectDefineProperty(module.exports,bkey,{
932935
enumerable: false,value: constants[bkey],writable: false
933936
});

0 commit comments

Comments
(0)