diff options
| author | Guilherme Minozzi <[email protected]> | 2022-07-22 00:04:44 -0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-07-22 05:04:44 +0200 |
| commit | 3afc793f5b54fe3095d66f4e95af81e3e5a428d9 (patch) | |
| tree | cbd06a1e3a7cecdc5e4fbb06cb51a3915dd0f474 /src/modules | |
| parent | fbddaa39e830e1ac44e7821d219ca7859af79e95 (diff) | |
| download | faker-3afc793f5b54fe3095d66f4e95af81e3e5a428d9.tar.xz faker-3afc793f5b54fe3095d66f4e95af81e3e5a428d9.zip | |
refactor(company): rename companyName to name (#1166)
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/company/index.ts | 28 | ||||
| -rw-r--r-- | src/modules/finance/index.ts | 2 |
2 files changed, 27 insertions, 3 deletions
diff --git a/src/modules/company/index.ts b/src/modules/company/index.ts index fb5f2e66..968afbbf 100644 --- a/src/modules/company/index.ts +++ b/src/modules/company/index.ts @@ -1,4 +1,5 @@ import type { Faker } from '../..'; +import { deprecated } from '../../internal/deprecated'; /** * Module to generate company related entries. @@ -31,9 +32,9 @@ export class Company { * @param format The optional format index used to select a format. * * @example - * faker.company.companyName() // 'Zieme, Hauck and McClure' + * faker.company.name() // 'Zieme, Hauck and McClure' */ - companyName(format?: number): string { + name(format?: number): string { const formats = [ '{{name.lastName}} {{company.companySuffix}}', '{{name.lastName}} - {{name.lastName}}', @@ -48,6 +49,29 @@ export class Company { } /** + * Generates a random company name. + * + * @param format The optional format index used to select a format. + * + * @see faker.company.name + * + * @example + * faker.company.companyName() // 'Zieme, Hauck and McClure' + * + * @deprecated Use `faker.company.name()` instead + */ + companyName(format?: number): string { + deprecated({ + deprecated: 'faker.company.companyName()', + proposed: 'faker.company.name()', + since: '7.4', + until: '8.0', + }); + + return this.name(format); + } + + /** * Returns a random company suffix. * * @example diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts index ff9ffc68..5d83963b 100644 --- a/src/modules/finance/index.ts +++ b/src/modules/finance/index.ts @@ -424,7 +424,7 @@ export class Finance { */ transactionDescription(): string { const amount = this.amount(); - const company = this.faker.company.companyName(); + const company = this.faker.company.name(); const transactionType = this.transactionType(); const account = this.account(); const card = this.mask(); |
