Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b6f74b0

Browse filesBrowse files
rchouguledanielleadams
authored andcommitted
zlib: refactor to use primordial instead of <string>.startsWith
PR-URL: #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>
1 parent d70824f commit b6f74b0
Copy full SHA for b6f74b0

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Open diff view settings
Collapse file

‎lib/zlib.js‎

Copy file name to clipboardExpand all lines: lib/zlib.js
+5-2Lines 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
const kMaxBrotliParam = 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
const brotliInitParamsArray = new Uint32Array(kMaxBrotliParam + 1);
@@ -927,7 +930,7 @@ ObjectDefineProperties(module.exports, {
927930
// These should be considered deprecated
928931
// expose all the zlib constants
929932
for (const bkey of ObjectKeys(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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.