npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

walking-cat

v0.0.3

Published

Geographical coordinates parse, transform and format utilities

Downloads

2

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