aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorDivisionByZero <[email protected]>2024-04-15 00:27:11 +0200
committerGitHub <[email protected]>2024-04-15 00:27:11 +0200
commit453ea970a4c7ed19e9d41fd026923f42dbd4e768 (patch)
treeda1e48fa8fc1186b8b185a1f9e24c7d6e921c7cb /src/modules
parent734a7f3d55d1233d8182585bb79d2013f0ce289e (diff)
downloadfaker-453ea970a4c7ed19e9d41fd026923f42dbd4e768.tar.xz
faker-453ea970a4c7ed19e9d41fd026923f42dbd4e768.zip
refactor(locale)!: remove location data index-value-binding (#2476)
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/location/index.ts22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts
index 217fe682..8fbbbe30 100644
--- a/src/modules/location/index.ts
+++ b/src/modules/location/index.ts
@@ -427,14 +427,16 @@ export class LocationModule extends ModuleBase {
const { abbreviated = false } = options;
if (!abbreviated) {
- return this.faker.helpers.arrayElement(
- this.faker.definitions.location.direction
- );
+ return this.faker.helpers.arrayElement([
+ ...this.faker.definitions.location.direction.cardinal,
+ ...this.faker.definitions.location.direction.ordinal,
+ ]);
}
- return this.faker.helpers.arrayElement(
- this.faker.definitions.location.direction_abbr
- );
+ return this.faker.helpers.arrayElement([
+ ...this.faker.definitions.location.direction.cardinal_abbr,
+ ...this.faker.definitions.location.direction.ordinal_abbr,
+ ]);
}
/**
@@ -465,12 +467,12 @@ export class LocationModule extends ModuleBase {
if (!abbreviated) {
return this.faker.helpers.arrayElement(
- this.faker.definitions.location.direction.slice(0, 4)
+ this.faker.definitions.location.direction.cardinal
);
}
return this.faker.helpers.arrayElement(
- this.faker.definitions.location.direction_abbr.slice(0, 4)
+ this.faker.definitions.location.direction.cardinal_abbr
);
}
@@ -502,12 +504,12 @@ export class LocationModule extends ModuleBase {
if (!abbreviated) {
return this.faker.helpers.arrayElement(
- this.faker.definitions.location.direction.slice(4, 8)
+ this.faker.definitions.location.direction.ordinal
);
}
return this.faker.helpers.arrayElement(
- this.faker.definitions.location.direction_abbr.slice(4, 8)
+ this.faker.definitions.location.direction.ordinal_abbr
);
}