Skip to content

Commit

Permalink
Last bugfix was not a bug fix.
Browse files Browse the repository at this point in the history
Reverted isIPRange back to the previous state.
j
  • Loading branch information
Daniel Guimaraes committed Jun 7, 2018
1 parent 192b06f commit f374563
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
12 changes: 6 additions & 6 deletions lib/isIPRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ var subnetMaybe = /^\d{1,2}$/;
function isIPRange(str) {
(0, _assertString2.default)(str);

var rangeParts = str.split('/');
var _str$split = str.split('/'),
_str$split2 = _slicedToArray(_str$split, 3),
ip = _str$split2[0],
subnet = _str$split2[1],
err = _str$split2[2];

if (rangeParts.length !== 2) {
if (typeof err !== 'undefined') {
return false;
}

var _rangeParts = _slicedToArray(rangeParts, 2),
ip = _rangeParts[0],
subnet = _rangeParts[1];

if (!subnetMaybe.test(subnet)) {
return false;
}
Expand Down
6 changes: 1 addition & 5 deletions src/lib/isIPRange.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ export default function isIPRange(str) {
assertString(str);
const [ip, subnet, err] = str.split('/');

if (typeof subnet === 'undefined') {
return false;
}

if (typeof err !== 'undefined') {
return false;
}
Expand All @@ -24,5 +20,5 @@ export default function isIPRange(str) {
return false;
}

return isIP(ip) && subnet <= 32 && subnet >= 0;
return isIP(ip, 4) && subnet <= 32 && subnet >= 0;
}
12 changes: 6 additions & 6 deletions validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,16 +541,16 @@ var subnetMaybe = /^\d{1,2}$/;
function isIPRange(str) {
assertString(str);

var rangeParts = str.split('/');
var _str$split = str.split('/'),
_str$split2 = slicedToArray(_str$split, 3),
ip = _str$split2[0],
subnet = _str$split2[1],
err = _str$split2[2];

if (rangeParts.length !== 2) {
if (typeof err !== 'undefined') {
return false;
}

var _rangeParts = slicedToArray(rangeParts, 2),
ip = _rangeParts[0],
subnet = _rangeParts[1];

if (!subnetMaybe.test(subnet)) {
return false;
}
Expand Down
Loading

0 comments on commit f374563

Please sign in to comment.