Skip to content

Commit

Permalink
crypto: revise variables for const use instead of let
Browse files Browse the repository at this point in the history
This prepares the code for enabling the no-cond-assign rule.

PR-URL: #41614
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
Trott authored and BethGriggs committed Jan 24, 2022
1 parent 0d6227c commit 627f19a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/internal/crypto/scrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -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');
}
Expand All @@ -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');
}
Expand Down

0 comments on commit 627f19a

Please sign in to comment.