dcousens/haversine-distance

Add tests for 0 latitude / 0 longitude

dcousens opened this issue · 0 comments

const aLat = toRad(Array.isArray(a) ? a[1] : a.latitude || a.lat)
const bLat = toRad(Array.isArray(b) ? b[1] : b.latitude || b.lat)
const aLng = toRad(Array.isArray(a) ? a[0] : a.longitude || a.lng || a.lon)
const bLng = toRad(Array.isArray(b) ? b[0] : b.longitude || b.lng || b.lon)

0 || undefined is undefined, which probably results in NaN for the followup calculations