Comparing version 0.0.2 to 0.0.3
@@ -28,3 +28,7 @@ // haversine | ||
return R * c | ||
if (options.threshold) { | ||
return options.threshold > (R * c) ? true : false | ||
} else { | ||
return R * c | ||
} | ||
} | ||
@@ -34,2 +38,2 @@ | ||
module.exports = haversine | ||
module.exports = haversine |
{ | ||
"name": "haversine", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A simple haversine module", | ||
@@ -5,0 +5,0 @@ "main": "haversine.js", |
@@ -15,8 +15,8 @@ # Haversine | ||
start = { | ||
latitude: 10, | ||
longitude: 11 | ||
latitude: 30.849635, | ||
longitude: -83.24559 | ||
} | ||
end = { | ||
latitude: 11, | ||
longitude: 10 | ||
latitude: 27.950575, | ||
longitude: -82.457178 | ||
} | ||
@@ -26,4 +26,3 @@ | ||
console.log(haversine(start, end, {unit: 'km'})) | ||
## Future | ||
I plan on adding more options soon including a threshold check. | ||
console.log(haversine(start, end, {threshold: 1})) | ||
console.log(haversine(start, end, {threshold: 1, unit: 'km'})) |
var haversine = require('../haversine'); | ||
start = { | ||
latitude: 50.03, | ||
longitude: 05 | ||
latitude: 30.849635, | ||
longitude: -83.24559 | ||
} | ||
end = { | ||
latitude: 58.38, | ||
longitude: 03 | ||
latitude: 27.950575, | ||
longitude: -82.457178 | ||
} | ||
@@ -20,2 +20,8 @@ | ||
// using objects with unit conversion | ||
console.log(haversine(start, end, {unit: 'km'})) | ||
console.log(haversine(start, end, {unit: 'km'})) | ||
// utilizing the threshold option | ||
console.log(haversine(start, end, {threshold: 1})) | ||
// utilizing the threshold option & unit conversion | ||
console.log(haversine(start, end, {threshold: 1, unit: 'km'})) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2654
45
26