Skip to content

Commit

Permalink
upload first good version (v1.0.7)
Browse files Browse the repository at this point in the history
  • Loading branch information
carmi2214 committed Apr 25, 2020
1 parent 8dd0f47 commit 529dec3
Show file tree
Hide file tree
Showing 14 changed files with 5,388 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

# WebStorm
.idea/
17 changes: 17 additions & 0 deletions .travis.yml
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
45 changes: 43 additions & 2 deletions README.md
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).
261 changes: 261 additions & 0 deletions countries.geojson

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Loading

0 comments on commit 529dec3

Please sign in to comment.