Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.72 KB

README.md

File metadata and controls

49 lines (37 loc) · 1.72 KB

find-region-from-location

Build Status Dependency Status devDependency Status Code Climate

Node module to find closest region for a given latitude and longitude

Install

npm install https://github.com/Lissy93/find-region-from-location --save

Usage

var findRegion =  require('find-region-from-location');

findRegion.country(52.2, -1.6); // 'United Kingdom'
findRegion.alpha2_code(-8.29, -50); // 'BR'
findRegion.alpha3_code(40, -3); // 'ESP'
findRegion.numeric_code(48.8,2.5); // '250'

There are 5 functions, country(lat, lng), alpha2_code(lat, lng), alpha3_code(lat, lng), numeric_code(lat, lng) and regionObject(lat, lng)

regionObject(latitude, longitude) will return data in the following format:

{ 
    country: 'France',
    alpha2_code: 'FR',
    alpha3_code: 'FRA',
    numeric_code: '250',
    latitude: 46,
    longitude: 2,
    diff: 3 
}

Testing

npm test

See unit test, integration testing results on Travis CI

Development

See the gulpfile.js for documentation of build process.

License

MIT � Alicia Sykes