zlib: refactor to use primordial instead of <string>.startsWith
PR-URL: https://github.com/nodejs/node/pull/36718 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
This commit is contained in:
parent
a3606f25dc
commit
7a6af022e6
@ -37,6 +37,7 @@ const {
|
||||
ObjectKeys,
|
||||
ObjectSetPrototypeOf,
|
||||
ReflectApply,
|
||||
StringPrototypeStartsWith,
|
||||
Symbol,
|
||||
TypedArrayPrototypeFill,
|
||||
Uint32Array,
|
||||
@ -786,7 +787,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);
|
||||
@ -927,7 +930,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
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user