Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const testIp = function(ip, mode) {
const constraint = this
// Check if it is an array or a string
if (typeof constraint === 'string') {
if (rangeCheck.validRange(constraint)) {
return testCidrBlock(ip, constraint, mode)
} else {
return testExplicitIp(ip, constraint, mode)
}
}
if (typeof constraint === 'object') {
return testRange(ip, constraint, mode)
}
}
allowedRanges = _.filter(allowedRanges, function (ipRange) {
return range_check.validRange(ipRange);
});