humanize-distance

1.0.9 • Public • Published

humanize-distance

Calculates a humanized distance between 2 Points (longitude, latitude)

Example outputs: < 50m, 450m, 750yd, 0.9 mi, 2,8 km

bitHound Overall Score npm Package travis-ci.org js-standard-style license

Usage

npm i humanize-distance --save
 
const humanizeDistance = require('humanize-distance')
 
console.log(humanizeDistance(
  {latitude: 50.95, longitude: 6.91},
  {latitude: 50.9486184, longitude: 6.9426425},
  'de-DE',
  'metric'))
// 2,8 km
 
console.log(humanizeDistance(
  {latitude: 50.9440107, longitude: 6.9419526},
  {latitude: 50.9486184, longitude: 6.9426425},
  'en-US',
  'us'))
// 550 yd
 

Twitter URL GitHub stars

Package Sidebar

Install

npm i humanize-distance

Weekly Downloads

15

Version

1.0.9

License

MIT

Last publish

Collaborators

  • stockulus