diff options
| author | ST-DDT <[email protected]> | 2023-04-23 18:51:27 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-23 18:51:27 +0200 |
| commit | 8a0bbf5faa03c294d308a13fe210ba6aaeef6968 (patch) | |
| tree | c3fc64e877992b09b0c7699201b103aac1b06071 /src/modules | |
| parent | 2675ec20fe28ebf89fc8b5b939c9ae7fbde7559f (diff) | |
| download | faker-8a0bbf5faa03c294d308a13fe210ba6aaeef6968.tar.xz faker-8a0bbf5faa03c294d308a13fe210ba6aaeef6968.zip | |
feat: introduce locale proxy (#2004)
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/helpers/index.ts | 2 | ||||
| -rw-r--r-- | src/modules/location/index.ts | 3 | ||||
| -rw-r--r-- | src/modules/person/index.ts | 8 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index 48c8cea0..0bb54fb6 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -1160,7 +1160,7 @@ export class HelpersModule { const parts = method.split('.'); let currentModuleOrMethod: unknown = this.faker; - let currentDefinitions: unknown = this.faker.definitions; + let currentDefinitions: unknown = this.faker.rawDefinitions; // Search for the requested method or definition for (const part of parts) { diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index c39711b7..26ead8ad 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -73,8 +73,7 @@ export class LocationModule { const { state } = options; if (state) { - const zipRange = - this.faker.definitions.location.postcode_by_state?.[state]; + const zipRange = this.faker.definitions.location.postcode_by_state[state]; if (zipRange) { return String(this.faker.number.int(zipRange)); diff --git a/src/modules/person/index.ts b/src/modules/person/index.ts index 789cd58c..428b1373 100644 --- a/src/modules/person/index.ts +++ b/src/modules/person/index.ts @@ -102,7 +102,7 @@ export class PersonModule { */ firstName(sex?: SexType): string { const { first_name, female_first_name, male_first_name } = - this.faker.definitions.person; + this.faker.rawDefinitions.person ?? {}; return selectDefinition(this.faker, this.faker.helpers.arrayElement, sex, { generic: first_name, @@ -132,7 +132,7 @@ export class PersonModule { last_name_pattern, male_last_name_pattern, female_last_name_pattern, - } = this.faker.definitions.person; + } = this.faker.rawDefinitions.person ?? {}; if ( last_name_pattern != null || @@ -174,7 +174,7 @@ export class PersonModule { */ middleName(sex?: SexType): string { const { middle_name, female_middle_name, male_middle_name } = - this.faker.definitions.person; + this.faker.rawDefinitions.person ?? {}; return selectDefinition(this.faker, this.faker.helpers.arrayElement, sex, { generic: middle_name, @@ -315,7 +315,7 @@ export class PersonModule { */ prefix(sex?: SexType): string { const { prefix, female_prefix, male_prefix } = - this.faker.definitions.person; + this.faker.rawDefinitions.person ?? {}; return selectDefinition(this.faker, this.faker.helpers.arrayElement, sex, { generic: prefix, |
