aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGuilherme Minozzi <[email protected]>2022-07-22 00:04:44 -0300
committerGitHub <[email protected]>2022-07-22 05:04:44 +0200
commit3afc793f5b54fe3095d66f4e95af81e3e5a428d9 (patch)
treecbd06a1e3a7cecdc5e4fbb06cb51a3915dd0f474 /src/modules
parentfbddaa39e830e1ac44e7821d219ca7859af79e95 (diff)
downloadfaker-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.ts28
-rw-r--r--src/modules/finance/index.ts2
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();