Here's a JS version:
> const ip2dec = ip => ip.split(".").reverse().reduce((acc, n, i) => acc + (parseInt(n) * (2 ** (i * 8))), 0) > ip2dec("192.168.0.1") 3232235521 > ip2dec("192.168.1.1") 3232235777 > ip2dec("0xDE.0xAD.0xBE.0xEF") 3735928559
Here's a JS version: