From 1e7534e92ac002c0281a47336343f39e29065630 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 9 Jan 2023 20:22:46 +0100 Subject: [PATCH] refactor(company): deprecate suffix methods (#1719) --- src/definitions/company.ts | 2 ++ src/modules/company/index.ts | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/definitions/company.ts b/src/definitions/company.ts index 354fc3c6601..6d70cb36802 100644 --- a/src/definitions/company.ts +++ b/src/definitions/company.ts @@ -41,6 +41,8 @@ export type CompanyDefinitions = LocaleEntry<{ /** * Company/Business entity types. + * + * @deprecated Use `faker.company.name` instead. */ suffix: string[]; }>; diff --git a/src/modules/company/index.ts b/src/modules/company/index.ts index 70c40521a9f..79f2fa8f710 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. @@ -18,12 +19,22 @@ export class CompanyModule { /** * Returns an array with possible company name suffixes. * + * @see faker.company.name() + * * @example * faker.company.suffixes() // [ 'Inc', 'and Sons', 'LLC', 'Group' ] * * @since 2.0.1 + * + * @deprecated Use `faker.company.name` instead. */ suffixes(): string[] { + deprecated({ + deprecated: 'faker.company.suffixes', + proposed: 'faker.company.name', + since: '8.0', + until: '9.0', + }); // Don't want the source array exposed to modification, so return a copy return this.faker.definitions.company.suffix.slice(0); } @@ -45,12 +56,22 @@ export class CompanyModule { /** * Returns a random company suffix. * + * @see faker.company.name() + * * @example * faker.company.companySuffix() // 'and Sons' * * @since 2.0.1 + * + * @deprecated Use `faker.company.name` instead. */ companySuffix(): string { + deprecated({ + deprecated: 'faker.company.companySuffix', + proposed: 'faker.company.name', + since: '8.0', + until: '9.0', + }); return this.faker.helpers.arrayElement(this.suffixes()); }