diff --git a/lib/zlib.js b/lib/zlib.js index d5228e28e9a89a..4cc45a7c26d8b2 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -37,6 +37,7 @@ const { ObjectKeys, ObjectSetPrototypeOf, ReflectApply, + StringPrototypeStartsWith, Symbol, TypedArrayPrototypeFill, Uint32Array, @@ -781,7 +782,9 @@ function createConvenienceMethod(ctor, sync) { const kMaxBrotliParam = MathMax(...ArrayPrototypeMap( ObjectKeys(constants), - (key) => (key.startsWith('BROTLI_PARAM_') ? constants[key] : 0) + (key) => (StringPrototypeStartsWith(key, 'BROTLI_PARAM_') ? + constants[key] : + 0) )); const brotliInitParamsArray = new Uint32Array(kMaxBrotliParam + 1); @@ -922,7 +925,7 @@ ObjectDefineProperties(module.exports, { // These should be considered deprecated // expose all the zlib constants for (const bkey of ObjectKeys(constants)) { - if (bkey.startsWith('BROTLI')) continue; + if (StringPrototypeStartsWith(bkey, 'BROTLI')) continue; ObjectDefineProperty(module.exports, bkey, { enumerable: false, value: constants[bkey], writable: false });