aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGuilherme Minozzi <[email protected]>2022-08-22 15:53:08 -0300
committerGitHub <[email protected]>2022-08-22 18:53:08 +0000
commite1f26a6d2c79f3d9540f1890669631aca0fe5527 (patch)
treed16ef0af09069eb3ad458ff2e349b4ae1cd3e4bd /src/modules
parent0866ee9217e5e0b60e1c5f604e3576fb2604a3d5 (diff)
downloadfaker-e1f26a6d2c79f3d9540f1890669631aca0fe5527.tar.xz
faker-e1f26a6d2c79f3d9540f1890669631aca0fe5527.zip
feat(company): move name formats to locales (#1293)
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);
}