country-iso
Advanced tools
Comparing version 1.0.3 to 1.0.4
17
index.js
@@ -32,5 +32,20 @@ 'use strict'; | ||
/** | ||
* Searches for every country which contains the point (lat, lng) | ||
* @param {Number} lat Latitude of the point | ||
* @param {Number} lng Longitude of the point | ||
* @return {String[]} Array of ISO 3166 alpha-3 country code for the geographic coordinates | ||
*/ | ||
function getCodeSync(lat, lng) { | ||
if (this.worldGeojson === undefined) { | ||
throw new Error('No geographical data loaded'); | ||
} | ||
const countries = this.worldLookup.search(lng, lat, -1); | ||
return countries.features.map(f => f.properties.ISO_A3); | ||
} | ||
module.exports = { | ||
use: useGeoJSON, | ||
get: getCode | ||
get: getCode, | ||
getSync: getCodeSync | ||
}; |
{ | ||
"name": "country-iso", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Get ISO 3166-1 alpha-3 country code for geographic coordinates.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -54,3 +54,18 @@ # country-iso | ||
Longitude of the point. | ||
### getSync(lat, lng) | ||
Searches for every country which contains the point (lat, lng). | ||
#### lat | ||
Type: `number` | ||
Latitude of the point. | ||
#### lng | ||
Type: `number` | ||
Longitude of the point. | ||
## Authors | ||
@@ -57,0 +72,0 @@ * **Matteo Chen** - [chq-matteo](https://github.com/chq-matteo) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6852
45
78