what-is-my-ip-address
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

What Is My IP Address

Your external IP address in a JavaScript library.

npm Version Build Status David David Coverage Status Code Climate

Why?

I am aware that there are other libraries out there to get your public / external IP right with JavaScript (public-ip, external-ip). But they faced a serious compatibility issue: they did not support ES5.

Although some think that ES5 is a thing of a past (with all due respect), some builders are still requiring it, for example Uglify (which comes built-in with angular-cli). Thus, it is currently recommended to transpile to ES5.

What-Is-My-Ip-Address aims to support developers looking forward to gather their IP address on the client side. The latest versions of Node should be fine regardless since they understand ES6.

Getting started

npm install --save what-is-my-ip-address

IP v4:

var ip = require('what-is-my-ip-address');
ip.v4()
  .then((ip) => {
    ...
  })
  .catch((error) => {
    // Do you have IP v4?
  });

IP v6:

var ip = require('what-is-my-ip-address');
ip.v6()
  .then((ip) => {
    ...
  })
  .catch((error) => {
    // Do you have IP v6?
  });

Contributions

Contributions are very welcome.

Special thanks

To @major/icanhaz for his awesome IP address service.

License

MIT © Gerard Rovira Sánchez

Package Sidebar

Install

npm i what-is-my-ip-address

Weekly Downloads

189

Version

1.0.3

License

MIT

Last publish

Collaborators

  • zurfyx