Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix missing deprecations #2614

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 57 additions & 53 deletions src/modules/finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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).
*
Expand Down Expand Up @@ -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).
*
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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 };
}

Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand All @@ -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 };
}

Expand Down
25 changes: 16 additions & 9 deletions src/modules/location/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand All @@ -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
*/
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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 };
}

Expand Down Expand Up @@ -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;
/**
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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 };
}

Expand Down
Loading