Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isCIDR = str => {
if (typeof str !== 'string') return false
let split = str.split('/')
if (split.length !== 2) return false
if (!validator.isIP(split[0], 4)) return false
let num = parseInt(split[1])
return Number.isInteger(num) && num >= 0 && num <= 32 && ('' + num === split[1])
}
ip(value, version) {
return validator.isIP(value, version);
},
ISBN(value, version) {
function _isIP(v) {
return v && isIP(v);
}
Array.isArray(ipAliasing) ? ipAliasing.filter(ent =>
typeof ent.mac === 'string' && validator.isMACAddress(ent.mac) &&
typeof ent.ipv4 === 'string' && validator.isIP(ent.ipv4, 4)) : undefined
if(!full.startsWith('https://'))
return 'Full node must run through https protocol';
if(!solidity.startsWith('https://'))
return 'Solditity node must run through https protocol';
if(event && !event.startsWith('https://'))
return 'Event server must run through https protocol';
if(!validator.isURL(full) && !validator.isIP(full))
return 'Invalid full node provided';
if(!validator.isURL(solidity) && !validator.isIP(solidity))
return 'Invalid solidity node provided';
if(!validator.isURL(event) && !validator.isIP(event))
return 'Invalid event server provided';
if(!this.isBoolean(mainnet))
return 'Invalid network type provided';
return false;
},
if(!this.isString(name) || !name.length || name.length > 256)
return 'Invalid node name provided';
if(!full.startsWith('https://'))
return 'Full node must run through https protocol';
if(!solidity.startsWith('https://'))
return 'Solditity node must run through https protocol';
if(event && !event.startsWith('https://'))
return 'Event server must run through https protocol';
if(!validator.isURL(full) && !validator.isIP(full))
return 'Invalid full node provided';
if(!validator.isURL(solidity) && !validator.isIP(solidity))
return 'Invalid solidity node provided';
if(!validator.isURL(event) && !validator.isIP(event))
return 'Invalid event server provided';
if(!this.isBoolean(mainnet))
return 'Invalid network type provided';
return false;
},
"ipv4": function (ipv4) {
if (typeof ipv4 !== "string") { return true; }
return validator.isIP(ipv4, 4);
},
"ipv6": function (ipv6) {
function validateIpAddress(value, validation, key) {
if (!validator.isIP(value)) {
SettingsValidator.errors.push('INVALID_IP_ADDRESS for ' + key + ', must be a valid IP Address')
return true
}
return true
}
exports.isIPaddress = function(address){
return validator.isIP(address, 4);
};
Visitor.prototype.setIpv = function(ipv){
if (lo.includes(ipvs, ipv)){
this.ipv = ipv;
return;
}
if (validator.isIP(this.ip, 4)){
this.ipv = 4;
return;
}
if (validator.isIP(this.ip, 6)){
this.ipv = 6;
return;
}
throw Error('Failed to determine ipv from ip: ' + this.ip);
};