aboutsummaryrefslogtreecommitdiff
path: root/src/modules/location
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-11-13 09:20:17 +0100
committerGitHub <[email protected]>2023-11-13 08:20:17 +0000
commita747854d6b5d4db5c02ff344b8abb322c6ceac99 (patch)
treedd1b53816d9c6ba3986ed85b001dbdcd68111f4b /src/modules/location
parent7ce8c285cb5b2d13e95a17be78ecbd52f3c7d9db (diff)
downloadfaker-a747854d6b5d4db5c02ff344b8abb322c6ceac99.tar.xz
faker-a747854d6b5d4db5c02ff344b8abb322c6ceac99.zip
test(docs): ensure defaults are consistent (#2177)
Diffstat (limited to 'src/modules/location')
-rw-r--r--src/modules/location/index.ts72
1 files changed, 49 insertions, 23 deletions
diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts
index baf51c51..1c20d713 100644
--- a/src/modules/location/index.ts
+++ b/src/modules/location/index.ts
@@ -18,7 +18,7 @@ export class LocationModule extends ModuleBase {
* Generates random zip code from specified format. If format is not specified,
* the locale's zip format is used.
*
- * @param options The format used to generate the zip code or an options object. Defaults to `{}`.
+ * @param options The format used to generate the zip code or an options object.
* @param options.state The state to generate the zip code for.
* If the current locale does not have a corresponding `postcode_by_state` definition, an error is thrown.
* @param options.format The optional format used to generate the zip code.
@@ -85,7 +85,7 @@ export class LocationModule extends ModuleBase {
*
* If the current locale does not have a corresponding `postcode_by_state` definition, an error is thrown.
*
- * @param options A state abbreviation or an options object. Defaults to `{}`.
+ * @param options A state abbreviation or an options object.
* @param options.state The abbreviation of the state to generate the zip code for.
* If not specified, a random zip code is generated according to the locale's zip format.
*
@@ -227,7 +227,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random localized street address.
*
- * @param options Whether to use a full address or an options object. Defaults to `{}`.
+ * @param options Whether to use a full address or an options object.
* @param options.useFullAddress When true this will generate a full address.
* Otherwise it will just generate a street address.
*
@@ -314,7 +314,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code.
*
- * @param options The code to return or an options object. Defaults to `{}`.
+ * @param options The code to return or an options object.
* @param options.variant The variant to return. Can be one of:
*
* - `'alpha-2'` (two-letter code)
@@ -373,7 +373,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random localized state, or other equivalent first-level administrative entity for the locale's country such as a province or region.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.abbreviated If true this will return abbreviated first-level administrative entity names.
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -427,7 +427,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random latitude.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.max The upper bound for the latitude to generate. Defaults to `90`.
* @param options.min The lower bound for the latitude to generate. Defaults to `-90`.
* @param options.precision The number of decimal points of precision for the latitude. Defaults to `4`.
@@ -479,7 +479,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random latitude.
*
- * @param options The upper bound for the latitude or an options object. Defaults to `{}`.
+ * @param options The upper bound for the latitude or an options object.
* @param options.max The upper bound for the latitude to generate. Defaults to `90`.
* @param options.min The lower bound for the latitude to generate. Defaults to `-90`.
* @param options.precision The number of decimal points of precision for the latitude. Defaults to `4`.
@@ -526,7 +526,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random latitude.
*
- * @param options The upper bound for the latitude or an options object. Defaults to `{}`.
+ * @param options The upper bound for the latitude or an options object.
* @param options.max The upper bound for the latitude to generate. Defaults to `90`.
* @param options.min The lower bound for the latitude to generate. Defaults to `-90`.
* @param options.precision The number of decimal points of precision for the latitude. Defaults to `4`.
@@ -582,7 +582,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random longitude.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
@@ -618,7 +618,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random longitude.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
@@ -635,7 +635,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random longitude.
*
- * @param options The upper bound for the longitude or an options object. Defaults to `{}`.
+ * @param options The upper bound for the longitude or an options object.
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
@@ -679,7 +679,7 @@ export class LocationModule extends ModuleBase {
/**
* Generates a random longitude.
*
- * @param options An options object. Defaults to `{}`.
+ * @param options An options object.
* @param options.max The upper bound for the longitude to generate. Defaults to `180`.
* @param options.min The lower bound for the longitude to generate. Defaults to `-180`.
* @param options.precision The number of decimal points of precision for the longitude. Defaults to `4`.
@@ -735,7 +735,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random direction (cardinal and ordinal; northwest, east, etc).
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.abbreviated If true this will return abbreviated directions (NW, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -773,7 +773,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random direction (cardinal and ordinal; northwest, east, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -799,7 +799,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random direction (cardinal and ordinal; northwest, east, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -848,7 +848,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random cardinal direction (north, east, south, west).
*
- * @param options The options to use. Defaults to `{}`.
+ * @param options The options to use.
* @param options.abbreviated If true this will return abbreviated directions (N, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -912,7 +912,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random cardinal direction (north, east, south, west).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (N, E, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -960,7 +960,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random ordinal direction (northwest, southeast, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -982,7 +982,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random ordinal direction (northwest, southeast, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -999,7 +999,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random ordinal direction (northwest, southeast, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -1025,7 +1025,7 @@ export class LocationModule extends ModuleBase {
/**
* Returns a random ordinal direction (northwest, southeast, etc).
*
- * @param options Whether to use abbreviated or an options object. Defaults to `{}`.
+ * @param options Whether to use abbreviated or an options object.
* @param options.abbreviated If true this will return abbreviated directions (NW, SE, etc).
* Otherwise this will return the long name. Defaults to `false`.
*
@@ -1087,8 +1087,21 @@ export class LocationModule extends ModuleBase {
* @since 8.0.0
*/
nearbyGPSCoordinate(options?: {
+ /**
+ * The original coordinate to get a new coordinate close to.
+ */
origin?: [latitude: number, longitude: number];
+ /**
+ * The maximum distance from the given coordinate to the new coordinate.
+ *
+ * @default 10
+ */
radius?: number;
+ /**
+ * If `true` assume the radius to be in kilometers. If `false` for miles.
+ *
+ * @default false
+ */
isMetric?: boolean;
}): [latitude: number, longitude: number];
/**
@@ -1121,8 +1134,8 @@ export class LocationModule extends ModuleBase {
* If no coordinate is given, a random one will be chosen.
* @param options.radius The maximum distance from the given coordinate to the new coordinate. Defaults to `10`.
* @param options.isMetric If `true` assume the radius to be in kilometers. If `false` for miles. Defaults to `false`.
- * @param legacyRadius Deprecated, use `options.radius` instead.
- * @param legacyIsMetric Deprecated, use `options.isMetric` instead.
+ * @param legacyRadius Deprecated, use `options.radius` instead. Defaults to `10`.
+ * @param legacyIsMetric Deprecated, use `options.isMetric` instead. Defaults to `false`.
*
* @example
* faker.location.nearbyGPSCoordinate() // [ 33.8475, -170.5953 ]
@@ -1135,8 +1148,21 @@ export class LocationModule extends ModuleBase {
options?:
| [latitude: number, longitude: number]
| {
+ /**
+ * The original coordinate to get a new coordinate close to.
+ */
origin?: [latitude: number, longitude: number];
+ /**
+ * The maximum distance from the given coordinate to the new coordinate.
+ *
+ * @default 10
+ */
radius?: number;
+ /**
+ * If `true` assume the radius to be in kilometers. If `false` for miles.
+ *
+ * @default false
+ */
isMetric?: boolean;
},
legacyRadius?: number,