From 3afc793f5b54fe3095d66f4e95af81e3e5a428d9 Mon Sep 17 00:00:00 2001 From: Guilherme Minozzi Date: Fri, 22 Jul 2022 00:04:44 -0300 Subject: refactor(company): rename companyName to name (#1166) --- src/modules/company/index.ts | 28 ++++++++++++++++++++++++++-- src/modules/finance/index.ts | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'src/modules') 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}}', @@ -47,6 +48,29 @@ export class Company { return this.faker.fake(formats[format]); } + /** + * 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. * 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(); -- cgit v1.2.3