aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/helpers/index.ts2
-rw-r--r--src/modules/location/index.ts3
-rw-r--r--src/modules/person/index.ts8
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,