-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
5,388 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,6 @@ dist | |
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# WebStorm | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- 12.9.1 | ||
|
||
jobs: | ||
include: | ||
- stage: test | ||
script: npm run test | ||
# - stage: npm publish | ||
# script: echo "Deploying to npm ..." | ||
# deploy: | ||
# provider: npm | ||
# email: "$NPM_AUTH_EMAIL" | ||
# api_key: "$NPM_AUTH_TOKEN" | ||
# on: | ||
# branch: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,43 @@ | ||
# country-locator | ||
Detects country by given coordinate | ||
# Country Locator | ||
Detects country by given coordinate.<br/> | ||
Good for offline usage. | ||
|
||
[![build status](https://travis-ci.com/carmi2214/country-locator.svg?branch=master)](https://travis-ci.com/carmi2214/country-locator) | ||
[![npm](https://img.shields.io/npm/v/country-locator)](https://www.npmjs.com/package/country-locator) | ||
[![license](https://img.shields.io/npm/l/country-locator)](LICENSE) | ||
|
||
## Installation | ||
```shell script | ||
npm install country-locator | ||
``` | ||
|
||
## Usage | ||
`findCountryByCoordinate` returns country info with two fields : | ||
- name : the common name for the country | ||
- code : three letters iso code of the country _(ISO3166-1-Alpha-3)_ | ||
|
||
```typescript | ||
import {findCountryByCoordinate} from "country-locator"; | ||
|
||
const countryInfo = findCountryByCoordinate(51.500760, -0.125168); | ||
|
||
console.log(countryInfo?.name); // United Kingdom | ||
console.log(countryInfo?.code); // GBR | ||
``` | ||
|
||
```typescript | ||
const countryInfo = findCountryByCoordinate(0, 0); | ||
|
||
console.log(countryInfo); // undefined | ||
``` | ||
|
||
## Test | ||
```shell script | ||
npm run test | ||
``` | ||
|
||
## Data | ||
`countries.geojson` comes from [geo-countries](https://github.com/datasets/geo-countries). | ||
|
||
## License | ||
Country Locator is [MIT licensed](LICENSE). |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; |
Oops, something went wrong.