From 31b8840fe819ac842de2d9030925b6199882c0c2 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 30 Oct 2023 14:39:52 +0100 Subject: [PATCH 1/2] docs(phone): improve deprecation and see message --- src/modules/phone/index.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/modules/phone/index.ts b/src/modules/phone/index.ts index b677ec4a6b8..7472f75d36e 100644 --- a/src/modules/phone/index.ts +++ b/src/modules/phone/index.ts @@ -17,6 +17,9 @@ export class PhoneModule { /** * Generates a random phone number. * + * @see faker.string.numeric(): For generating a random string of numbers. + * @see faker.helpers.fromRegExp(): For generating a phone number matching a regular expression. + * * @example * faker.phone.number() // '961-770-7727' * @@ -28,13 +31,16 @@ export class PhoneModule { * * @param format Format of the phone number. * + * @see faker.string.numeric(): For generating a random string of numbers. + * @see faker.helpers.fromRegExp(): For generating a phone number matching a regular expression. + * * @example * faker.phone.number('501-###-###') // '501-039-841' * faker.phone.number('+48 91 ### ## ##') // '+48 91 463 61 70' * * @since 7.3.0 * - * @deprecated Use `faker.phone.number()` without an argument instead. + * @deprecated Use `faker.phone.number()` without an argument, `faker.string.numeric()` or `faker.helpers.fromRegExp()` instead. */ number(format: string): string; /** @@ -42,6 +48,9 @@ export class PhoneModule { * * @param format Format of the phone number. Defaults to a random phone number format. * + * @see faker.string.numeric(): For generating a random string of numbers. + * @see faker.helpers.fromRegExp(): For generating a phone number matching a regular expression. + * * @example * faker.phone.number() // '961-770-7727' * @@ -52,7 +61,8 @@ export class PhoneModule { if (format != null) { deprecated({ deprecated: 'faker.phone.number(format)', - proposed: 'faker.phone.number()', + proposed: + 'faker.phone.number() or faker.string.numeric() or faker.helpers.fromRegExp()', since: '8.1', until: '9.0', }); From f09423d17eb1d437a29ad82c27f4e5fe565c2a58 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Mon, 30 Oct 2023 20:53:35 +0100 Subject: [PATCH 2/2] Update src/modules/phone/index.ts Co-authored-by: DivisionByZero --- src/modules/phone/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/phone/index.ts b/src/modules/phone/index.ts index 7472f75d36e..448cdf784f8 100644 --- a/src/modules/phone/index.ts +++ b/src/modules/phone/index.ts @@ -62,7 +62,7 @@ export class PhoneModule { deprecated({ deprecated: 'faker.phone.number(format)', proposed: - 'faker.phone.number() or faker.string.numeric() or faker.helpers.fromRegExp()', + 'faker.phone.number(), faker.string.numeric() or faker.helpers.fromRegExp()', since: '8.1', until: '9.0', });