From aedd7b8bb0e6074f69659a79df1e6b75900f5894 Mon Sep 17 00:00:00 2001 From: Guilherme Minozzi Date: Sat, 30 Jul 2022 15:10:59 -0300 Subject: [PATCH] refactor(company.name): deprecate `format` parameter (#1212) --- src/modules/company/index.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/company/index.ts b/src/modules/company/index.ts index 1dce91fd935..d98eb89e6dd 100644 --- a/src/modules/company/index.ts +++ b/src/modules/company/index.ts @@ -29,7 +29,7 @@ export class Company { /** * Generates a random company name. * - * @param format The optional format index used to select a format. + * @param format The optional format index used to select a format. Deprecated, do not use. * * @example * faker.company.name() // 'Zieme, Hauck and McClure' @@ -41,6 +41,15 @@ export class Company { '{{name.lastName}}, {{name.lastName}} and {{name.lastName}}', ]; + if (format != null) { + deprecated({ + deprecated: 'faker.company.name(format)', + proposed: 'faker.company.name()', + since: '7.4', + until: '8.0', + }); + } + if (typeof format !== 'number') { format = this.faker.datatype.number(formats.length - 1); }