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

parse-coordinates

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-coordinates

parse coordinate strings

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

parse-coordinates

Parse coordinate strings.

##Synopsis

var latLng = require('parse-coordinates');

var coords = latLng('-80.21, 21.32');
// => [-80.21, 21.32]

Description

  var coords = latLng('-80.21, 21.32');
  // => [-80.21, 21.32]

The function returned parses a comma separated latitude and longitude pair and returns them as an array.

Latitude is validated to range from -90 to 90. Longitude value is validated to range from -180 to 180.

Leading and trailing space are tolerated in the string, as well as around the comma.

If the parsing fails for any reason, null is returned instead of the array.

Author

Mark Stosberg <mark@rideamigos.com>

Credit

Forked from to-coordinates, which lacked validation of the number coordinates as well as the valid lat/lng value ranges.

Licence

MIT

Keywords

FAQs

Package last updated on 09 Oct 2015

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