Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  dist
  package.json
  README.md
Size: Mime:
  README.md

web-geolocation

Simple promise based geolocation service

Exposes a function to geolocate the current client. It uses the free geolocation service at https://freegeoip.net.

Usage

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
}