Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hboon/ipsidekick-js
A https://ipsidekick.com wrapper
https://github.com/hboon/ipsidekick-js
Last synced: 22 days ago
JSON representation
A https://ipsidekick.com wrapper
- Host: GitHub
- URL: https://github.com/hboon/ipsidekick-js
- Owner: hboon
- License: mit
- Created: 2017-10-16T15:09:56.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-16T15:49:41.000Z (about 7 years ago)
- Last Synced: 2024-12-04T13:48:52.002Z (28 days ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ipsidekick
> https://ipsidekick.com wrapper
## Install
```
$ npm install --save ipsidekick
```## Usage
```js
const resolveIP = require('ipsidekick')// Current IP address information
resolveIP((error, json) => {
if (error) {
console.log('Error:')
console.log(error)
} else {
console.log('Info for current IP address:\n')
console.log(json)
}
})// For a given IP address
resolveIP('17.142.160.59', (error, json) => {
if (error) {
console.log('\nError:')
console.log(error)
} else {
console.log('\nInfo for given IP address:\n')
console.log(json)// Example output:
// {
// "ip" : "17.142.160.59",
// "currency" : {
// "code" : "USD",
// "name" : "US dollar",
// "decimals" : 2
// },
// "country" : {
// "name" : "United States",
// "code" : "US"
// },
// "timeZone" : {
// "name" : "America/Los_Angeles",
// "gmtOffset" : "GMT-7:00"
// }
// }console.log(`\nCountry: ${json.country.name}`)
console.log(`Currency: ${json.currency.name}`)
console.log(`Time zone: ${json.timeZone.name}\n`)
}
})
```## License
MIT Hwee-Boon Yar