Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const {
ObjectKeys,
ObjectSetPrototypeOf,
ReflectApply,
StringPrototypeStartsWith,
Symbol,
TypedArrayPrototypeFill,
Uint32Array,
Expand Down Expand Up @@ -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)
Comment on lines +790 to +792
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I find it easier to read on one line, but you can leave it as is if you prefer.

Suggested change
(key) => (StringPrototypeStartsWith(key, 'BROTLI_PARAM_') ?
constants[key] :
0)
(key) =>
(StringPrototypeStartsWith(key, 'BROTLI_PARAM_') ? constants[key] : 0)

));

const brotliInitParamsArray = new Uint32Array(kMaxBrotliParam + 1);
Expand Down Expand Up @@ -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
});
Expand Down