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: nodejs#22115
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
MaleDong authored and Trott committed Aug 7, 2018
1 parent e570ae7 commit 493e6d4
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 493e6d4

Please sign in to comment.