From 83800fabec45530245711e07ddb0628acdf088e9 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 9 Jul 2018 16:51:20 +0200 Subject: [PATCH] [squash] get rid of options.hasOwnProperty --- lib/internal/crypto/scrypt.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js index 24a3570809b8bf..edfe522be47a74 100644 --- a/lib/internal/crypto/scrypt.js +++ b/lib/internal/crypto/scrypt.js @@ -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;