diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts index 219c2702606..111db57101c 100644 --- a/src/modules/finance/index.ts +++ b/src/modules/finance/index.ts @@ -376,31 +376,6 @@ export class FinanceModule extends ModuleBase { return template; } - /** - * Generates a random amount between the given bounds (inclusive). - * - * @param min The lower bound for the amount. Defaults to `0`. - * @param max The upper bound for the amount. Defaults to `1000`. - * @param dec The number of decimal places for the amount. Defaults to `2`. - * @param symbol The symbol used to prefix the amount. Defaults to `''`. - * @param autoFormat If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`. - * - * @example - * faker.finance.amount() // '617.87' - * faker.finance.amount(5, 10) // '5.53' - * faker.finance.amount(5, 10, 0) // '8' - * faker.finance.amount(5, 10, 2, '$') // '$5.85' - * faker.finance.amount(5, 10, 5, '', true) // '9,75067' - * - * @since 2.0.1 - */ - amount( - min?: number, - max?: number, - dec?: number, - symbol?: string, - autoFormat?: boolean - ): string; /** * Generates a random amount between the given bounds (inclusive). * @@ -452,6 +427,33 @@ export class FinanceModule extends ModuleBase { */ autoFormat?: boolean; }): string; + /** + * Generates a random amount between the given bounds (inclusive). + * + * @param min The lower bound for the amount. Defaults to `0`. + * @param max The upper bound for the amount. Defaults to `1000`. + * @param dec The number of decimal places for the amount. Defaults to `2`. + * @param symbol The symbol used to prefix the amount. Defaults to `''`. + * @param autoFormat If true this method will use `Number.toLocaleString()`. Otherwise it will use `Number.toFixed()`. + * + * @example + * faker.finance.amount() // '617.87' + * faker.finance.amount(5, 10) // '5.53' + * faker.finance.amount(5, 10, 0) // '8' + * faker.finance.amount(5, 10, 2, '$') // '$5.85' + * faker.finance.amount(5, 10, 5, '', true) // '9,75067' + * + * @since 2.0.1 + * + * @deprecated Use `faker.finance.amount({ min, max, dec, symbol, autoFormat })` instead. + */ + amount( + min?: number, + max?: number, + dec?: number, + symbol?: string, + autoFormat?: boolean + ): string; /** * Generates a random amount between the given bounds (inclusive). * @@ -472,10 +474,6 @@ export class FinanceModule extends ModuleBase { * faker.finance.amount({ min: 5, max: 10, dec: 0 }) // '8' * faker.finance.amount({ min: 5, max: 10, dec: 2, symbol: '$' }) // '$5.85' * faker.finance.amount({ min: 5, max: 10, dec: 5, symbol: '', autoFormat: true }) // '9,75067' - * faker.finance.amount(5, 10) // '5.53' - * faker.finance.amount(5, 10, 0) // '8' - * faker.finance.amount(5, 10, 2, '$') // '$5.85' - * faker.finance.amount(5, 10, 5, '', true) // '9,75067' * * @since 2.0.1 */ @@ -539,10 +537,6 @@ export class FinanceModule extends ModuleBase { * faker.finance.amount({ min: 5, max: 10, dec: 0 }) // '8' * faker.finance.amount({ min: 5, max: 10, dec: 2, symbol: '$' }) // '$5.85' * faker.finance.amount({ min: 5, max: 10, dec: 5, symbol: '', autoFormat: true }) // '9,75067' - * faker.finance.amount(5, 10) // '5.53' - * faker.finance.amount(5, 10, 0) // '8' - * faker.finance.amount(5, 10, 2, '$') // '$5.85' - * faker.finance.amount(5, 10, 5, '', true) // '9,75067' * * @since 2.0.1 */ @@ -587,6 +581,12 @@ export class FinanceModule extends ModuleBase { legacyAutoFormat: boolean = false ): string { if (typeof options === 'number') { + deprecated({ + deprecated: 'faker.finance.amount(min, max, dec, symbol, autoFormat)', + proposed: 'faker.finance.amount({ min, max, dec, symbol, autoFormat })', + since: '8.0', + until: '9.0', + }); options = { min: options }; } @@ -987,22 +987,6 @@ export class FinanceModule extends ModuleBase { return address; } - /** - * Generates a random iban. - * - * @param formatted Return a formatted version of the generated IBAN. Defaults to `false`. - * @param countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used. - * - * @throws Will throw an error if the passed country code is not supported. - * - * @example - * faker.finance.iban() // 'TR736918640040966092800056' - * faker.finance.iban(true) // 'FR20 8008 2330 8984 74S3 Z620 224' - * faker.finance.iban(true, 'DE') // 'DE84 1022 7075 0900 1170 01' - * - * @since 4.0.0 - */ - iban(formatted?: boolean, countryCode?: string): string; /** * Generates a random iban. * @@ -1032,6 +1016,24 @@ export class FinanceModule extends ModuleBase { */ countryCode?: string; }): string; + /** + * Generates a random iban. + * + * @param formatted Return a formatted version of the generated IBAN. Defaults to `false`. + * @param countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used. + * + * @throws Will throw an error if the passed country code is not supported. + * + * @example + * faker.finance.iban() // 'TR736918640040966092800056' + * faker.finance.iban(true) // 'FR20 8008 2330 8984 74S3 Z620 224' + * faker.finance.iban(true, 'DE') // 'DE84 1022 7075 0900 1170 01' + * + * @since 4.0.0 + * + * @deprecated Use `faker.finance.iban({ formatted, countryCode })` instead. + */ + iban(formatted?: boolean, countryCode?: string): string; /** * Generates a random iban. * @@ -1046,8 +1048,6 @@ export class FinanceModule extends ModuleBase { * faker.finance.iban() // 'TR736918640040966092800056' * faker.finance.iban({ formatted: true }) // 'FR20 8008 2330 8984 74S3 Z620 224' * faker.finance.iban({ formatted: true, countryCode: 'DE' }) // 'DE84 1022 7075 0900 1170 01' - * faker.finance.iban(true) // 'FR20 8008 2330 8984 74S3 Z620 224' - * faker.finance.iban(true, 'DE') // 'DE84 1022 7075 0900 1170 01' * * @since 4.0.0 */ @@ -1083,8 +1083,6 @@ export class FinanceModule extends ModuleBase { * faker.finance.iban() // 'TR736918640040966092800056' * faker.finance.iban({ formatted: true }) // 'FR20 8008 2330 8984 74S3 Z620 224' * faker.finance.iban({ formatted: true, countryCode: 'DE' }) // 'DE84 1022 7075 0900 1170 01' - * faker.finance.iban(true) // 'FR20 8008 2330 8984 74S3 Z620 224' - * faker.finance.iban(true, 'DE') // 'DE84 1022 7075 0900 1170 01' * * @since 4.0.0 */ @@ -1107,6 +1105,12 @@ export class FinanceModule extends ModuleBase { legacyCountryCode?: string ): string { if (typeof options === 'boolean') { + deprecated({ + deprecated: 'faker.finance.iban(formatted, countryCode)', + proposed: 'faker.finance.iban({ formatted, countryCode })', + since: '8.0', + until: '9.0', + }); options = { formatted: options }; } diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index 20e260934ca..0bd679cc037 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -477,6 +477,8 @@ export class LocationModule extends ModuleBase { * faker.location.latitude(10, -10, 5) // 2.68452 * * @since 8.0.0 + * + * @deprecated Use `faker.location.latitude({ max, min, precision })` instead. */ latitude(max?: number, min?: number, precision?: number): number; /** @@ -494,9 +496,6 @@ export class LocationModule extends ModuleBase { * faker.location.latitude({ max: 10 }) // 5.7225 * faker.location.latitude({ max: 10, min: -10 }) // -9.6273 * faker.location.latitude({ max: 10, min: -10, precision: 5 }) // 2.68452 - * faker.location.latitude(10) // 5.7225 - * faker.location.latitude(10, -10) // -9.6273 - * faker.location.latitude(10, -10, 5) // 2.68452 * * @since 8.0.0 */ @@ -541,9 +540,6 @@ export class LocationModule extends ModuleBase { * faker.location.latitude({ max: 10 }) // 5.7225 * faker.location.latitude({ max: 10, min: -10 }) // -9.6273 * faker.location.latitude({ max: 10, min: -10, precision: 5 }) // 2.68452 - * faker.location.latitude(10) // 5.7225 - * faker.location.latitude(10, -10) // -9.6273 - * faker.location.latitude(10, -10, 5) // 2.68452 * * @since 8.0.0 */ @@ -574,6 +570,12 @@ export class LocationModule extends ModuleBase { legacyPrecision = 4 ): number { if (typeof options === 'number') { + deprecated({ + deprecated: 'faker.location.latitude(max, min, precision)', + proposed: 'faker.location.latitude({ max, min, precision })', + since: '8.0', + until: '9.0', + }); options = { max: options }; } @@ -633,6 +635,8 @@ export class LocationModule extends ModuleBase { * faker.location.longitude({ max: 10, min: -10, precision: 5 }) // 2.68452 * * @since 8.0.0 + * + * @deprecated Use `faker.location.longitude({ max, min, precision })` instead. */ longitude(max?: number, min?: number, precision?: number): number; /** @@ -694,9 +698,6 @@ export class LocationModule extends ModuleBase { * faker.location.longitude({ max: 10 }) // 2.4387 * faker.location.longitude({ max: 10, min: -10 }) // 6.9126 * faker.location.longitude({ max: 10, min: -10, precision: 5 }) // -4.03620 - * faker.location.longitude(10) // 2.4387 - * faker.location.longitude(10, -10) // 6.9126 - * faker.location.longitude(10, -10, 5) // -4.03620 * * @since 8.0.0 */ @@ -727,6 +728,12 @@ export class LocationModule extends ModuleBase { legacyPrecision = 4 ): number { if (typeof options === 'number') { + deprecated({ + deprecated: 'faker.location.longitude(max, min, precision)', + proposed: 'faker.location.longitude({ max, min, precision })', + since: '8.0', + until: '9.0', + }); options = { max: options }; }