Skip to content

Commit 751c92d

Browse files
committed
crypto: remove obsolete encoding check
This renames the parameters for clarity and removes the check for undefined encoding. That will always default to `utf8`. PR-URL: #26809 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 92db780 commit 751c92d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/internal/crypto/util.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ function getDefaultEncoding() {
5555
// This is here because many functions accepted binary strings without
5656
// any explicit encoding in older versions of node, and we don't want
5757
// to break them unnecessarily.
58-
function toBuf(str, encoding) {
59-
if (typeof str === 'string') {
60-
if (encoding === 'buffer' || !encoding)
58+
function toBuf(val, encoding) {
59+
if (typeof val === 'string') {
60+
if (encoding === 'buffer')
6161
encoding = 'utf8';
62-
return Buffer.from(str, encoding);
62+
return Buffer.from(val, encoding);
6363
}
64-
return str;
64+
return val;
6565
}
6666

6767
const getCiphers = cachedResult(() => filterDuplicateStrings(_getCiphers()));

0 commit comments

Comments
 (0)