Repository URL to install this package:
|
Version:
0.0.6 ▾
|
| .idea |
| dist |
| package.json |
| README.md |
| yarn-error.log |
Simple promise based geolocation service
Exposes a function to geolocate the current client. It uses the free geolocation service at https://freegeoip.net.
import geolocationApi from '@doodle/geolocation'; geolocationApi().then(geolocation => { ... }).catch(error => { ... })
The object returned by the geolocation service has the following shape:
{ "ip": "84.74.100.162", "country_code": "CH", "country_name": "Switzerland", "region_code": "ZH", "region_name": "Zurich", "city": "Zurich", "zip_code": "8047", "time_zone": "Europe/Zurich", "latitude": 47.3667, "longitude" :8.55, "metro_code": 0 }