UNPKG

asn-from-ip

Version:

This tiny module allows you to get ASN information for each IP address. The output includes IP suffixes, AS type, AS country, AS organisation and so on...

2 lines (1 loc) 168 B
function ipToASN(n){return new Promise(function(t){fetch("https://api.ipapi.is/?q="+n).then(n=>n.json()).then(function(n){try{n&&n.asn&&t(n.asn)}catch(n){}t(null)})})}