From 453ea970a4c7ed19e9d41fd026923f42dbd4e768 Mon Sep 17 00:00:00 2001 From: DivisionByZero Date: Mon, 15 Apr 2024 00:27:11 +0200 Subject: refactor(locale)!: remove location data index-value-binding (#2476) --- src/modules/location/index.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/modules') 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 ); } -- cgit v1.2.3