Skip to content

Commit

Permalink
refactor(company)!: remove hardcoded name fallback pattern (#1451)
Browse files Browse the repository at this point in the history
  • Loading branch information
Minozzzi committed Oct 14, 2022
1 parent d3fb2c0 commit b99ff71
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/modules/company/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit b99ff71

Please sign in to comment.