From b99ff713306170e337e597714ffa1ac1ae17fc82 Mon Sep 17 00:00:00 2001 From: Guilherme Minozzi Date: Fri, 14 Oct 2022 20:33:50 -0300 Subject: [PATCH] refactor(company)!: remove hardcoded name fallback pattern (#1451) --- src/modules/company/index.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/modules/company/index.ts b/src/modules/company/index.ts index 73b059b4928..e9e9bf09b31 100644 --- a/src/modules/company/index.ts +++ b/src/modules/company/index.ts @@ -36,16 +36,10 @@ export class CompanyModule { * @since 7.4.0 */ name(): string { - // ToDo: This `staticFormats` pattern should be removed in the future. It is only used to maintain backwards compatibility. - const staticFormats = [ - '{{name.lastName}} {{company.companySuffix}}', - '{{name.lastName}} - {{name.lastName}}', - '{{name.lastName}}, {{name.lastName}} and {{name.lastName}}', - ]; - const formats = - this.faker.definitions.company.name_patterns ?? staticFormats; + const pattern = this.faker.helpers.arrayElement( + this.faker.definitions.company.name_patterns + ); - const pattern = this.faker.helpers.arrayElement(formats); return this.faker.helpers.fake(pattern); }