Skip to content

Commit

Permalink
zlib: remove unused parameters
Browse files Browse the repository at this point in the history
When `checkRangesOrGetDefault` calls `checkFiniteNumber`, the latter
function only has two parameters, so `lower` and `upper` don't need to
be passed for validation.

PR-URL: #22115
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
MaleDong authored and rvagg committed Aug 15, 2018
1 parent 3f729aa commit 4b0d2de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ function checkFiniteNumber(number, name) {
throw err;
}

// 1. Returns def for undefined and NaN
// 1. Returns def for number when it's undefined or NaN
// 2. Returns number for finite numbers >= lower and <= upper
// 3. Throws ERR_INVALID_ARG_TYPE for non-numbers
// 4. Throws ERR_OUT_OF_RANGE for infinite numbers or numbers > upper or < lower
function checkRangesOrGetDefault(number, name, lower, upper, def) {
if (!checkFiniteNumber(number, name, lower, upper)) {
if (!checkFiniteNumber(number, name)) {
return def;
}
if (number < lower || number > upper) {
Expand Down

0 comments on commit 4b0d2de

Please sign in to comment.