humanize-distance
v1.0.9
Published
humanize the distance between 2 Points
Downloads
434
Maintainers
Readme
humanize-distance
Calculates a humanized distance between 2 Points (longitude, latitude)
Example outputs: < 50m, 450m, 750yd, 0.9 mi, 2,8 km
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