Comparing version 1.2.0 to 1.2.1
@@ -13,7 +13,37 @@ var kd = require("./kd"), | ||
function Position(object) { | ||
this.object = object | ||
this.position = spherical2cartesian( | ||
object.lat || object.latitude, | ||
object.lon || object.longitude || object.lng || object.long | ||
) | ||
var lat, lon; | ||
/* Find latitude. */ | ||
if(object.hasOwnProperty("lat")) | ||
lat = object.lat; | ||
else if(object.hasOwnProperty("latitude")) | ||
lat = object.latitude; | ||
else if(object.hasOwnProperty("location") && | ||
Array.isArray(object.location) && | ||
object.location.length === 2) | ||
lat = object.location[0]; | ||
/* Find longitude. */ | ||
if(object.hasOwnProperty("lon")) | ||
lon = object.lon; | ||
else if(object.hasOwnProperty("longitude")) | ||
lon = object.longitude; | ||
else if(object.hasOwnProperty("lng")) | ||
lon = object.lng; | ||
else if(object.hasOwnProperty("long")) | ||
lon = object.long; | ||
else if(object.hasOwnProperty("location") && | ||
Array.isArray(object.location) && | ||
object.location.length === 2) | ||
lon = object.location[1]; | ||
/* Finally, set this object's properties. */ | ||
this.object = object; | ||
this.position = spherical2cartesian(lat, lon); | ||
} | ||
@@ -20,0 +50,0 @@ |
{ | ||
"name": "sphere-knn", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "search for k nearest neighbors on a sphere", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
16805
450