aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/company/index.ts17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/modules/company/index.ts b/src/modules/company/index.ts
index 0a164fec..2a8b2db9 100644
--- a/src/modules/company/index.ts
+++ b/src/modules/company/index.ts
@@ -35,21 +35,24 @@ export class Company {
* faker.company.name() // 'Zieme, Hauck and McClure'
*/
name(format?: number): string {
- const formats = [
- '{{name.lastName}} {{company.companySuffix}}',
- '{{name.lastName}} - {{name.lastName}}',
- '{{name.lastName}}, {{name.lastName}} and {{name.lastName}}',
- ];
-
if (format != null) {
deprecated({
deprecated: 'faker.company.name(format)',
- proposed: 'faker.company.name()',
+ proposed: 'faker.company.name() or faker.helpers.fake(format)',
since: '7.4',
until: '8.0',
});
}
+ // 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;
+
if (typeof format !== 'number') {
format = this.faker.datatype.number(formats.length - 1);
}