Skip to content

docs: make clear that latitude is first on nearbyGPSCoordinate #864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 22, 2022
8 changes: 4 additions & 4 deletions src/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ function kilometersToMiles(miles: number): number {
* @param isMetric Metric: true, Miles: false.
*/
function coordinateWithOffset(
coordinate: [number, number],
coordinate: [latitude: number, longitude: number],
bearing: number,
distance: number,
isMetric: boolean
): number[] {
): [latitude: number, longitude: number] {
const R = 6378.137; // Radius of the Earth (http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html)
const d = isMetric ? distance : kilometersToMiles(distance); // Distance in km

Expand Down Expand Up @@ -492,10 +492,10 @@ export class Address {
*/
// TODO ST-DDT 2022-02-10: Allow coordinate parameter to be [string, string].
nearbyGPSCoordinate(
coordinate?: [number, number],
coordinate?: [latitude: number, longitude: number],
radius?: number,
isMetric?: boolean
): [string, string] {
): [latitude: string, longitude: string] {
// If there is no coordinate, the best we can do is return a random GPS coordinate.
if (coordinate === undefined) {
return [this.latitude(), this.longitude()];
Expand Down