crypto: revise variables for const use instead of let

This prepares the code for enabling the no-cond-assign rule.

PR-URL: https://github.com/nodejs/node/pull/41614
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Rich Trott
2022-01-20 06:05:32 -08:00
parent fbfb61a029
commit c05c8837c1

View File

@@ -98,8 +98,8 @@ function check(password, salt, keylen, options) {
let { N, r, p, maxmem } = defaults;
if (options && options !== defaults) {
let has_N, has_r, has_p;
if (has_N = (options.N !== undefined)) {
const has_N = options.N !== undefined;
if (has_N) {
N = options.N;
validateUint32(N, 'N');
}
@@ -108,7 +108,8 @@ function check(password, salt, keylen, options) {
N = options.cost;
validateUint32(N, 'cost');
}
if (has_r = (options.r !== undefined)) {
const has_r = (options.r !== undefined);
if (has_r) {
r = options.r;
validateUint32(r, 'r');
}
@@ -117,7 +118,8 @@ function check(password, salt, keylen, options) {
r = options.blockSize;
validateUint32(r, 'blockSize');
}
if (has_p = (options.p !== undefined)) {
const has_p = options.p !== undefined;
if (has_p) {
p = options.p;
validateUint32(p, 'p');
}