Skip to content

Commit

Permalink
[squash] get rid of options.hasOwnProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Jul 16, 2018
1 parent d38b2dd commit 83800fa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/internal/crypto/scrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,25 @@ function check(password, salt, keylen, options, callback) {
let { N, r, p, maxmem } = defaults;
if (options && options !== defaults) {
let has_N, has_r, has_p;
if (has_N = options.hasOwnProperty('N'))
if (has_N = (options.N !== undefined))
N = validateInt32(options.N, 'N', 0, INT_MAX);
if (options.hasOwnProperty('cost')) {
if (options.cost !== undefined) {
if (has_N) throw new ERR_CRYPTO_SCRYPT_INVALID_PARAMETER();
N = validateInt32(options.cost, 'cost', 0, INT_MAX);
}
if (has_r = options.hasOwnProperty('r'))
if (has_r = (options.r !== undefined))
r = validateInt32(options.r, 'r', 0, INT_MAX);
if (options.hasOwnProperty('blockSize')) {
if (options.blockSize !== undefined) {
if (has_r) throw new ERR_CRYPTO_SCRYPT_INVALID_PARAMETER();
r = validateInt32(options.blockSize, 'blockSize', 0, INT_MAX);
}
if (has_p = options.hasOwnProperty('p'))
if (has_p = (options.p !== undefined))
p = validateInt32(options.p, 'p', 0, INT_MAX);
if (options.hasOwnProperty('parallelization')) {
if (options.parallelization !== undefined) {
if (has_p) throw new ERR_CRYPTO_SCRYPT_INVALID_PARAMETER();
p = validateInt32(options.parallelization, 'parallelization', 0, INT_MAX);
}
if (options.hasOwnProperty('maxmem'))
if (options.maxmem !== undefined)
maxmem = validateInt32(options.maxmem, 'maxmem', 0, INT_MAX);
if (N === 0) N = defaults.N;
if (r === 0) r = defaults.r;
Expand Down

0 comments on commit 83800fa

Please sign in to comment.