Add properties and other doc cleanup
This commit is contained in:
parent
c355c99cbd
commit
1787f5ec4f
39
lib/geo.js
39
lib/geo.js
|
@ -106,9 +106,12 @@ exports.GeoPoint = GeoPoint;
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
* @class GeoPoint
|
* @class GeoPoint
|
||||||
* @param {Object} latlong Object with two Number properties: lat and long.
|
* @property {Number} lat The latitude in degrees.
|
||||||
* @prop {Number} lat
|
* @property {Number} lng The longitude in degrees.
|
||||||
* @prop {Number} lng
|
*
|
||||||
|
* @options {Object} Options Object with two Number properties: lat and long.
|
||||||
|
* @property {Number} lat The latitude point in degrees. Range: -90 to 90.
|
||||||
|
* @property {Number} lng The longitude point in degrees. Range: -90 to 90.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function GeoPoint(data) {
|
function GeoPoint(data) {
|
||||||
|
@ -138,20 +141,18 @@ function GeoPoint(data) {
|
||||||
assert(data.lat <= 90, 'lat must be <= 90');
|
assert(data.lat <= 90, 'lat must be <= 90');
|
||||||
assert(data.lat >= -90, 'lat must be >= -90');
|
assert(data.lat >= -90, 'lat must be >= -90');
|
||||||
|
|
||||||
/**
|
this.lat = data.lat;
|
||||||
* @property {Number} lat The latitude point in degrees. Range: -90 to 90.
|
|
||||||
*/
|
|
||||||
this.lat = data.lat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @property {Number} lng The longitude point in degrees. Range: -90 to 90.
|
|
||||||
*/
|
|
||||||
this.lng = data.lng;
|
this.lng = data.lng;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the spherical distance between two GeoPoints.
|
* Determine the spherical distance between two GeoPoints.
|
||||||
* Specify units of measurement with the 'type' property in options object. Type can be:
|
*
|
||||||
|
* @param {GeoPoint} pointA Point A
|
||||||
|
* @param {GeoPoint} pointB Point B
|
||||||
|
* @options {Object} options Options object with one key, 'type'. See below.
|
||||||
|
* @property {String} type Unit of measurement, one of:
|
||||||
|
*
|
||||||
* - `miles` (default)
|
* - `miles` (default)
|
||||||
* - `radians`
|
* - `radians`
|
||||||
* - `kilometers`
|
* - `kilometers`
|
||||||
|
@ -159,9 +160,6 @@ function GeoPoint(data) {
|
||||||
* - `miles`
|
* - `miles`
|
||||||
* - `feet`
|
* - `feet`
|
||||||
* - `degrees`
|
* - `degrees`
|
||||||
* @param {GeoPoint} pointA Point A
|
|
||||||
* @param {GeoPoint} pointB Point B
|
|
||||||
* @param {Object} options Options object; has one key, 'type', to specify the units of measurment (see above). Default is miles.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GeoPoint.distanceBetween = function distanceBetween(a, b, options) {
|
GeoPoint.distanceBetween = function distanceBetween(a, b, options) {
|
||||||
|
@ -190,7 +188,16 @@ GeoPoint.distanceBetween = function distanceBetween(a, b, options) {
|
||||||
* GeoPoint.distanceBetween(here, there, {type: 'miles'}) // 438
|
* GeoPoint.distanceBetween(here, there, {type: 'miles'}) // 438
|
||||||
* ```
|
* ```
|
||||||
* @param {Object} point GeoPoint object to which to measure distance.
|
* @param {Object} point GeoPoint object to which to measure distance.
|
||||||
* @param {Object} options Use type key to specify units of measurment (default is miles).
|
* @options {Object} options Options object with one key, 'type'. See below.
|
||||||
|
* @property {String} type Unit of measurement, one of:
|
||||||
|
*
|
||||||
|
* - `miles` (default)
|
||||||
|
* - `radians`
|
||||||
|
* - `kilometers`
|
||||||
|
* - `meters`
|
||||||
|
* - `miles`
|
||||||
|
* - `feet`
|
||||||
|
* - `degrees`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GeoPoint.prototype.distanceTo = function (point, options) {
|
GeoPoint.prototype.distanceTo = function (point, options) {
|
||||||
|
|
Loading…
Reference in New Issue