Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geo-loc-utils

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geo-loc-utils

js geolocation library - promise based method for retrieving navigator coords and other utils

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

geo-loc-utils

A small collection of geolocation/direction utilities.

  • getNavigatorCoords - get current position (a promise wrapper around Geolocation.getCurrentPosition)
  • degreeToCardinal - convert degree to a cardinal direction

Install

npm install geo-loc-utils

getNavigatorCoords

params:

  • options {object} - Geolocaiton.getCurrentPosition supports some options.
  • ignoreCache {boolean} - Results are stored in memory by default and returned by subsequent calls. To get around this pass true as the second argument to ignore cache.
import { getNavigatorCoords } from 'geo-loc-utils';

// prompts browser to allow location access
getNavigatorCoords()
  .then(position => console.log(position));

degreeToCardinal

params:

  • degree {Number} - degree to convert
  • secondaryInterCardinals {Boolean} - whether to include secondary interCardinal directions (i.e. 'NNE', 'SSW')
import { degreeToCardinal } from 'geo-loc-utils';

const windBearing = 342;
const windDirection = degreeToCardinal(windBearing);
console.log(windDirection);

Development

  • Notes:
    • Written in TypeScript
    • Compiled to UMD via WebPack
    • Compiled to ES6 via TSC
    • Typings generated by TSC
    • geolocation isn't supported when serving localhostf
  • Setup: pnpm install
  • Serve: pnpm run start

See index.ejs

Runtimes

Latest tested runtimes

  • node: 10.16.3
  • pnpm: 2.15.1

Keywords

FAQs

Package last updated on 29 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc