aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorShinigami <[email protected]>2023-04-18 17:26:59 +0200
committerGitHub <[email protected]>2023-04-18 17:26:59 +0200
commit5c3b6e032bdd0488c48b82c4395459be7ee50fb0 (patch)
tree951832789f14725642ebdb7be3f34a303660be48 /src/modules
parentfc13424b4d43bcdae6e2f2a4ffcf2130bbc357f6 (diff)
downloadfaker-5c3b6e032bdd0488c48b82c4395459be7ee50fb0.tar.xz
faker-5c3b6e032bdd0488c48b82c4395459be7ee50fb0.zip
refactor(finance): rename account to accountNumber (#2054)
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/finance/index.ts61
1 files changed, 44 insertions, 17 deletions
diff --git a/src/modules/finance/index.ts b/src/modules/finance/index.ts
index cca634c0..fba04ce8 100644
--- a/src/modules/finance/index.ts
+++ b/src/modules/finance/index.ts
@@ -1,5 +1,6 @@
import type { Faker } from '../..';
import { FakerError } from '../../errors/faker-error';
+import { deprecated } from '../../internal/deprecated';
import iban from './iban';
/**
@@ -29,7 +30,7 @@ export interface Currency {
*
* For a random amount, use [`amount()`](https://next.fakerjs.dev/api/finance.html#amount).
*
- * For traditional bank accounts, use: [`account()`](https://next.fakerjs.dev/api/finance.html#account), [`accountName()`](https://next.fakerjs.dev/api/finance.html#accountname), [`bic()`](https://next.fakerjs.dev/api/finance.html#bic), [`iban()`](https://next.fakerjs.dev/api/finance.html#iban), [`pin()`](https://next.fakerjs.dev/api/finance.html#pin) and [`routingNumber()`](https://next.fakerjs.dev/api/finance.html#routingnumber).
+ * For traditional bank accounts, use: [`accountNumber()`](https://next.fakerjs.dev/api/finance.html#accountnumber), [`accountName()`](https://next.fakerjs.dev/api/finance.html#accountname), [`bic()`](https://next.fakerjs.dev/api/finance.html#bic), [`iban()`](https://next.fakerjs.dev/api/finance.html#iban), [`pin()`](https://next.fakerjs.dev/api/finance.html#pin) and [`routingNumber()`](https://next.fakerjs.dev/api/finance.html#routingnumber).
*
* For credit card related methods, use: [`creditCardNumber()`](https://next.fakerjs.dev/api/finance.html#creditcardnumber), [`creditCardCVV()`](https://next.fakerjs.dev/api/finance.html#creditcardcvv), [`creditCardIssuer()`](https://next.fakerjs.dev/api/finance.html#creditcardissuer), [`transactionDescription()`](https://next.fakerjs.dev/api/finance.html#transactiondescription) and [`transactionType()`](https://next.fakerjs.dev/api/finance.html#transactiontype).
*
@@ -54,13 +55,39 @@ export class FinanceModule {
*
* @param length The length of the account number. Defaults to `8`.
*
+ * @see faker.finance.accountNumber()
+ *
* @example
* faker.finance.account() // 92842238
* faker.finance.account(5) // 32564
*
* @since 2.0.1
+ *
+ * @deprecated Use `faker.finance.accountNumber` instead.
+ */
+ account(length?: number): string {
+ deprecated({
+ deprecated: 'faker.finance.account',
+ proposed: 'faker.finance.accountNumber',
+ since: '8.0',
+ until: '9.0',
+ });
+
+ return this.accountNumber(length);
+ }
+
+ /**
+ * Generates a random account number.
+ *
+ * @param length The length of the account number. Defaults to `8`.
+ *
+ * @example
+ * faker.finance.accountNumber() // 92842238
+ * faker.finance.accountNumber(5) // 32564
+ *
+ * @since 8.0.0
*/
- account(length?: number): string;
+ accountNumber(length?: number): string;
/**
* Generates a random account number.
*
@@ -68,12 +95,12 @@ export class FinanceModule {
* @param options.length The length of the account number. Defaults to `8`.
*
* @example
- * faker.finance.account() // 92842238
- * faker.finance.account({ length: 5 }) // 32564
+ * faker.finance.accountNumber() // 92842238
+ * faker.finance.accountNumber({ length: 5 }) // 32564
*
- * @since 2.0.1
+ * @since 8.0.0
*/
- account(options?: {
+ accountNumber(options?: {
/**
* The length of the account number.
*
@@ -88,13 +115,13 @@ export class FinanceModule {
* @param optionsOrLength.length The length of the account number. Defaults to `8`.
*
* @example
- * faker.finance.account() // 92842238
- * faker.finance.account(5) // 28736
- * faker.finance.account({ length: 5 }) // 32564
+ * faker.finance.accountNumber() // 92842238
+ * faker.finance.accountNumber(5) // 28736
+ * faker.finance.accountNumber({ length: 5 }) // 32564
*
- * @since 2.0.1
+ * @since 8.0.0
*/
- account(
+ accountNumber(
optionsOrLength?:
| number
| {
@@ -113,13 +140,13 @@ export class FinanceModule {
* @param options.length The length of the account number. Defaults to `8`.
*
* @example
- * faker.finance.account() // 92842238
- * faker.finance.account(5) // 28736
- * faker.finance.account({ length: 5 }) // 32564
+ * faker.finance.accountNumber() // 92842238
+ * faker.finance.accountNumber(5) // 28736
+ * faker.finance.accountNumber({ length: 5 }) // 32564
*
- * @since 2.0.1
+ * @since 8.0.0
*/
- account(
+ accountNumber(
options:
| number
| {
@@ -1191,7 +1218,7 @@ export class FinanceModule {
const amount = this.amount();
const company = this.faker.company.name();
const transactionType = this.transactionType();
- const account = this.account();
+ const account = this.accountNumber();
const card = this.mask();
const currency = this.currencyCode();