Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
s-haversine
Advanced tools
This module calculates the distance between two points on Earth using lat/long coordinates. It is based on the haversine formula and includes a utility to convert from degrees/minutes/seconds to the signed decimal degrees format needed for the formula to work.
This can be used with the web Geolocation API, which provides lat/long coordinates.
Get a pair of latitude/longitude coordinates then use them as the arguments for the distance
method. Example:
import haversine from 's-haversine';
// ---------- [latitude, longitude];
const coords1 = [36.151829, -115.143296];
const coords2 = [36.151465, -115.146284];
haversine.distance(coords1, coords2); // 271.314... (meters)
This module requires coordinates to be in a signed decimal format. If you have coordinates in degrees/minutes/seconds (DMS) format, use the dmsToDecimal
method to convert them. For example, an input such as 40 20 50W
or 40°20'50" S
will return roughly -40.34722
.
havesine.dmsToDecimal('40 20 50W'); // -40.34722... (degrees)
The math involved in the haversine formula depends on knowledge of the Earth's radius. This is configured by default as 6371000
(in meters). If you need to fine tune this or use another radius, you can configure this by setting haversine.earthRadius
to a number before calling the distance method.
FAQs
Get distance between any two latitute/longitude coordinates
The npm package s-haversine receives a total of 262 weekly downloads. As such, s-haversine popularity was classified as not popular.
We found that s-haversine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.