diff options
| author | Guilherme Minozzi <[email protected]> | 2022-10-14 20:33:50 -0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-10-15 01:33:50 +0200 |
| commit | b99ff713306170e337e597714ffa1ac1ae17fc82 (patch) | |
| tree | 05d82d1d58a7a20834bca8ed4a3e0d7d39c15c72 /src | |
| parent | d3fb2c0e0324740eccab6c8249f6c809a5681b53 (diff) | |
| download | faker-b99ff713306170e337e597714ffa1ac1ae17fc82.tar.xz faker-b99ff713306170e337e597714ffa1ac1ae17fc82.zip | |
refactor(company)!: remove hardcoded name fallback pattern (#1451)
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/company/index.ts | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/modules/company/index.ts b/src/modules/company/index.ts index 73b059b4..e9e9bf09 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); } |
