aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorShinigami <[email protected]>2024-01-24 18:09:37 +0100
committerGitHub <[email protected]>2024-01-24 18:09:37 +0100
commitca50f824919a199fd9c6148d5521e5bf991da156 (patch)
tree40aff90c67e002da69371f406786e2a2e7cdd08d /src/modules
parente0e9ab131f297deb0b49c3fc3fcdc10245b51c4a (diff)
downloadfaker-ca50f824919a199fd9c6148d5521e5bf991da156.tar.xz
faker-ca50f824919a199fd9c6148d5521e5bf991da156.zip
docs: fix missing deprecations (#2614)
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/finance/index.ts110
-rw-r--r--src/modules/location/index.ts25
2 files changed, 73 insertions, 62 deletions
diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts
index 219c2702..111db571 100644
--- a/src/modules/finance/index.ts
+++ b/src/modules/finance/index.ts
@@ -379,31 +379,6 @@ export class FinanceModule extends ModuleBase {
/**
* 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).
- *
* @param options An options object.
* @param options.min The lower bound for the amount. Defaults to `0`.
* @param options.max The upper bound for the amount. Defaults to `1000`.
@@ -455,6 +430,33 @@ export class FinanceModule extends ModuleBase {
/**
* 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).
+ *
* @param options An options object.
* @param options.min The lower bound for the amount. Defaults to `0`.
* @param options.max The upper bound for the amount. Defaults to `1000`.
@@ -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 };
}
@@ -990,22 +990,6 @@ export class FinanceModule extends ModuleBase {
/**
* 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.
- *
* @param options An options object.
* @param options.formatted Return a formatted version of the generated IBAN. Defaults to `false`.
* @param options.countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
@@ -1035,6 +1019,24 @@ export class FinanceModule extends ModuleBase {
/**
* 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.
+ *
* @param options An options object or whether the return value should be formatted.
* @param options.formatted Return a formatted version of the generated IBAN. Defaults to `false`.
* @param options.countryCode The country code from which you want to generate an IBAN, if none is provided a random country will be used.
@@ -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 20e26093..0bd679cc 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 };
}