# walking-cat

> Geographical coordinates parse, transform and format utilities

Latest version **0.0.3** (published 2017-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install walking-cat
pnpm add walking-cat
yarn add walking-cat
bun add walking-cat
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2017-09-02 |
| First published | 2017-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrey Korinskiy |
| Maintainers | parakhod |
| Keywords | geo, geograpgical, coordinates, map, measure, distance, latitude, longitude |

## Links

- npm: https://www.npmjs.com/package/walking-cat
- Repository: https://github.com/parakhod/walking-cat
- Homepage: https://github.com/parakhod/walking-cat#readme
- Issues: https://github.com/parakhod/walking-cat/issues
- npm.io page: https://npm.io/package/walking-cat

## Recent versions

- 0.0.3 (latest) — 2017-09-02
- 0.0.2 — 2017-09-02
- 0.0.1 — 2017-09-01

## README

# Walking Cat 

It is a simple JS library for parsing and converting geo coordinates

## Installation

__npm install -save walking-cat__

## Usage

`import coords from 'walking-cat';`


### Parsing
#### Parse string
The library tries to detect the latitude and longitude order automatically.

`const catPosition1 = coords('Hi, here are the coordinates of your cat: longitude 13.3666933, latitude 38.1190792');`

`const catPosition2 = coords(' 38°06′56.37″N    13°21′40.54″E');`

`const catPosition3 = coords('Ваш котик у нас, на долготе 37°36,9336′ в.д. и широте 55°45,1332′ с.ш.');`


#### Parse two strings
`const catPosition = coords('38°06′56.37″N', '13°21′40.54″E'); // order: latitude, longitude `

#### Parse two numbers
`const catPosition = coords(38.1190792, 13.3666933); // order: latitude, longitude `

#### Parse two numbers
`const catPosition = coords(38.1190792, 13.3666933); // order: latitude, longitude `

#### Parse array
`const catPosition = coords([13.3666933, 38.1190792]); // order: [longitude, latitude] `

#### Parse object
`const catPosition = coords({lat: 38.1190792, long: 13.3666933});`

`const catPosition = coords({latitude: 38.1190792, longitude: 13.3666933});`

#### Parse Immutable Map or List
`const catPosition = coords( Map({lat: 38.1190792, long: 13.3666933}));`

`const catPosition = coords( List([13.3666933, 38.1190792])); // order: [longitude, latitude] `

### Converting
#### To latitude and longitude
`const { lat, lng } = catPosition1;`
`console.log( lat, lng ); // output: 38.1190792, 13.3666933`

#### To string
`console.log( catPosition2.toString() ); // output: "38°6′56.37″N, 13°21′40.54″E"`

#### To string with comma instead of the point
`catPosition3.toString({point: ','}) // "55°45′7,99″N, 37°36′56,02″E"`

#### To array
`catPosition1.toArray() // [ 13.3666933, 38.1190792 ]`

### Measure distance

`const distance = coords(blackCat).distanceFrom(coords(whiteCat), options )`;
#### Option: units
Could be one of "m", "km", "mi", "yd", "ft"

#### Option: precision
Number value, if 0 - function returns rounded value, leave undefined if you don't need to trim the digits after the decimal point

#### Option: point
String value, you can replace the point with comma if needed. If _point_ is defined returned type is __string__, not __number__

---
_Source: https://npm.io/package/walking-cat · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
