-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tls: refactor to avoid unsafe array iteration
PR-URL: #36772 Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
Showing
3 changed files
with
23 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
const { | ||
ArrayIsArray, | ||
ArrayPrototypeForEach, | ||
ArrayPrototypePush, | ||
StringPrototypeIndexOf, | ||
StringPrototypeSlice, | ||
|
@@ -13,7 +14,7 @@ const { | |
// C=US\nST=CA\nL=SF\nO=Joyent\nOU=Node.js\nCN=ca1\[email protected] | ||
function parseCertString(s) { | ||
const out = ObjectCreate(null); | ||
for (const part of StringPrototypeSplit(s, '\n')) { | ||
ArrayPrototypeForEach(StringPrototypeSplit(s, '\n'), (part) => { | ||
const sepIndex = StringPrototypeIndexOf(part, '='); | ||
if (sepIndex > 0) { | ||
const key = StringPrototypeSlice(part, 0, sepIndex); | ||
|
@@ -27,7 +28,7 @@ function parseCertString(s) { | |
out[key] = value; | ||
} | ||
} | ||
} | ||
}); | ||
return out; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters