aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorDivisionByZero <[email protected]>2023-02-20 20:44:36 +0100
committerGitHub <[email protected]>2023-02-20 20:44:36 +0100
commita05c3e5fed805c5086a22841a81da0d86ab89386 (patch)
tree740f8e236e857066e0009ee51bddc755a684e134 /src/modules
parent0eba320543ea1e832a55c70e0025e924d3826812 (diff)
downloadfaker-a05c3e5fed805c5086a22841a81da0d86ab89386.tar.xz
faker-a05c3e5fed805c5086a22841a81da0d86ab89386.zip
refactor(location)!: countryCode use ISO-3166-1 (#1720)
Co-authored-by: Shinigami92 <[email protected]>
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/location/index.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts
index 4ce28bcf..2025beac 100644
--- a/src/modules/location/index.ts
+++ b/src/modules/location/index.ts
@@ -256,10 +256,10 @@ export class LocationModule {
}
/**
- * Returns a random country code.
+ * 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.variant The variant to return. Can be either `'alpha-2'` (2 letter code)
+ * @param options.variant The variant to return. Can be either `'alpha-2'` (two letter code)
* or `'alpha-3'` (three letter code). Defaults to `'alpha-2'`.
*
* @example
@@ -276,7 +276,7 @@ export class LocationModule {
| {
/**
* The code to return.
- * Can be either `'alpha-2'` (2 letter code)
+ * Can be either `'alpha-2'` (two letter code)
* or `'alpha-3'` (three letter code).
*
* @default 'alpha-2'
@@ -289,11 +289,11 @@ export class LocationModule {
}
const { variant = 'alpha-2' } = options;
- const key = variant === 'alpha-3' ? 'country_code_alpha_3' : 'country_code';
+ const key = variant === 'alpha-3' ? 'alpha3' : 'alpha2';
return this.faker.helpers.arrayElement(
- this.faker.definitions.location[key]
- );
+ this.faker.definitions.location.country_code
+ )[key];
}
/**