1.0.0 • Published 3 years ago

global-ip v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

global-ip

the simple wrapper of ip-api.com

const GlobalIP = require("./../src");

const gip = new GlobalIP();
gip
  .execute()
  .then((ip) => {
    console.log(ip);
  })
  .catch((errorCode) => {
    switch (errorCode) {
      case gip.CANNOT_FETCH_SELF_IP:
        console.log("cannot fetch ip");
        break;
      case gip.CANNOT_CONNECT_INTERNET:
        console.log("cannot connect internet");
        break;
      case gip.SOME_ERROR_HAPPENED:
        console.log("unhandled error!");
        break;
    }
  });

developer

up-tri