Use Array.prototype.map()

This commit is contained in:
iBug 2020-02-10 16:35:56 +08:00
parent e8e027b84d
commit 651befc638

View File

@ -2,9 +2,8 @@
// Time: @@TIME@@ // Time: @@TIME@@
function belongsToSubnet(host, list) { function belongsToSubnet(host, list) {
var ip = host.split("."); var ip = host.split(".").map(Number);
ip = 0x1000000 * Number(ip[0]) + 0x10000 * Number(ip[1]) + ip = 0x1000000 * ip[0] + 0x10000 * ip[1] + 0x100 * ip[2] + ip[3];
0x100 * Number(ip[2]) + Number(ip[3]);
if (ip < list[0][0]) if (ip < list[0][0])
return false; return false;