From d3eed99fa562b7cb0870dff29892bc8d87e9aafe Mon Sep 17 00:00:00 2001 From: Orlando Date: Mon, 25 Sep 2023 13:51:43 +0100 Subject: [PATCH] Company and phone number --- CHANGELOG.md | 6 ++++++ README.md | 2 ++ package.json | 2 +- src/constants/banking.ts | 27 ++++++++++----------------- src/constants/companies.ts | 19 +++++++++++++++++++ src/constants/phoneNumbers.ts | 7 +++++++ src/random/index.ts | 2 ++ src/random/randomCompany.ts | 13 +++++++++++++ src/random/randomPhoneNumber.ts | 6 ++++++ 9 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 src/constants/companies.ts create mode 100644 src/constants/phoneNumbers.ts create mode 100644 src/random/randomCompany.ts create mode 100644 src/random/randomPhoneNumber.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2cb00..5a3f1a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # deverything +## 0.28.0 + +### Minor Changes + +- company and phone number + ## 0.27.1 ### Patch Changes diff --git a/README.md b/README.md index c99e576..55085b6 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ These functions are optimized for low entropy random data generation useful for - ⭐ `randomArrayItem()` - `randomBankAccount()` - `randomBool()` +- `randomCompany()` - ⭐ `randomCoords()` - `randomLat()` - `randomLng()` @@ -124,6 +125,7 @@ These functions are optimized for low entropy random data generation useful for - `randomNumericId()` autoincremental process-unique id - `randomParagraph()` - `randomPassword()` +- `randomPhoneNumber()` - `randomUUID()` lightweight uuid generation, passing UUID validation - `randomWord()` diff --git a/package.json b/package.json index 2d2b770..67307ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "deverything", - "version": "0.27.1", + "version": "0.28.0", "description": "Everything you need for Dev", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/src/constants/banking.ts b/src/constants/banking.ts index 7025266..fdc040f 100644 --- a/src/constants/banking.ts +++ b/src/constants/banking.ts @@ -53,12 +53,6 @@ export const BANK_ACCOUNT_NUMBER_SAMPLES = [ "72796383", ]; -export const VAT_REGISTRATION_NUMBER_SAMPLES = [ - "IE1234567T", - "GB123456789", - "XI123456789", -]; - export const SORT_CODE_SAMPLES = ["100000", "902127", "800551"]; export const SSN_SAMPLES = ["235-55-7216", "372-37-3976", "414-99-6488"]; @@ -71,20 +65,11 @@ export const BANK_NAME_SAMPLES = [ "Goldman Sachs Group Inc.", ]; -export const COMPANY_NAME_SAMPLES = [ - "Acme Inc.", - "Globex Ltd.", - "Aurora LLC", - "Serenity Systems", - "Vulcan Ventures", - "Umbrella Corp.", -]; - export type BankAccount = { abaNumber?: string; accountHolderName: string; - accountHolderType?: "company" | "individual" | "other"; - accountNumber?: string; + accountHolderType: "company" | "individual" | "other"; + accountNumber: string; accountType?: "checking" | "savings"; bankName?: string; bsbNumber?: string; @@ -107,6 +92,7 @@ export const UK_BANK_ACCOUNT_SAMPLES: BankAccount[] = [ bicSwift: "BARCGB22", iban: "GB51BARC20039534871253", sortCode: "12-34-56", + accountHolderType: "individual", }, { accountHolderName: "Jane Evans", @@ -116,6 +102,7 @@ export const UK_BANK_ACCOUNT_SAMPLES: BankAccount[] = [ bicSwift: "HSBCGB2L", iban: "GB82BARC20031847813531", sortCode: "65-43-21", + accountHolderType: "company", }, ]; @@ -128,6 +115,7 @@ export const US_BANK_ACCOUNT_SAMPLES: BankAccount[] = [ "Bank of America Corporate Center, 100 North Tryon Street, Charlotte, NC 28255, USA", bankName: "Bank of America Corporation", routingNumber: "111000025", + accountHolderType: "individual", }, { accountHolderName: "Sally T King", @@ -136,6 +124,7 @@ export const US_BANK_ACCOUNT_SAMPLES: BankAccount[] = [ bankAddress: "383 Madison Avenue, New York, NY 10179, USA", bankName: "JPMorgan Chase & Co.", routingNumber: "021000021", + accountHolderType: "company", }, ]; @@ -149,6 +138,7 @@ export const AU_BANK_ACCOUNT_SAMPLES: BankAccount[] = [ bankName: "Commonwealth Bank of Australia", bicSwift: "CTBAAU2S", bsbNumber: "062-000", + accountHolderType: "individual", }, { accountHolderName: "Jennifer Ann Brown", @@ -158,6 +148,7 @@ export const AU_BANK_ACCOUNT_SAMPLES: BankAccount[] = [ bankName: "Westpac Banking Corporation", bicSwift: "WPACAU2S", bsbNumber: "032-001", + accountHolderType: "company", }, ]; @@ -171,6 +162,7 @@ export const CA_BANK_ACCOUNT_SAMPLES: BankAccount[] = [ bankName: "Royal Bank of Canada", branchTransitNumber: "45678", institutionNumber: "123", + accountHolderType: "individual", }, { accountHolderName: "Olivia Orange", @@ -181,6 +173,7 @@ export const CA_BANK_ACCOUNT_SAMPLES: BankAccount[] = [ bankName: "Toronto-Dominion Bank", branchTransitNumber: "65432", institutionNumber: "987", + accountHolderType: "company", }, ]; diff --git a/src/constants/companies.ts b/src/constants/companies.ts new file mode 100644 index 0000000..c0cdc5f --- /dev/null +++ b/src/constants/companies.ts @@ -0,0 +1,19 @@ +export const VAT_REGISTRATION_NUMBER_SAMPLES = [ + "IE1234567T", + "GB123456789", + "XI123456789", +]; + +export const COMPANY_NAME_SAMPLES = [ + "Acme Inc.", + "Globex Ltd.", + "Aurora LLC", + "Serenity Systems", + "Vulcan Ventures", + "Umbrella Corp.", +]; + +export type Company = { + name: string; + vatRegNumber?: string; +}; diff --git a/src/constants/phoneNumbers.ts b/src/constants/phoneNumbers.ts new file mode 100644 index 0000000..cf6d2df --- /dev/null +++ b/src/constants/phoneNumbers.ts @@ -0,0 +1,7 @@ +export const PHONE_NUMBER_SAMPLES = [ + "+44 20 7123 4567", // (United Kingdom) + "+33 1 45 67 89 10", // (France) + "+81 3 1234 5678", //(Japan) + "+61 2 9876 5432", //(Australia) + "+49 30 9876 5432", //(Germany) +]; diff --git a/src/random/index.ts b/src/random/index.ts index a234082..f568783 100644 --- a/src/random/index.ts +++ b/src/random/index.ts @@ -3,6 +3,7 @@ export * from "./randomAlphaNumericCode"; export * from "./randomArrayItem"; export * from "./randomBankAccount"; export * from "./randomBool"; +export * from "./randomCompany"; export * from "./randomCoords"; export * from "./randomDate"; export * from "./randomEmail"; @@ -21,6 +22,7 @@ export * from "./randomIP"; export * from "./randomName"; export * from "./randomNumericCode"; export * from "./randomNumericId"; +export * from "./randomPhoneNumber"; export * from "./randomParagraph"; export * from "./randomPassword"; export * from "./randomUUID"; diff --git a/src/random/randomCompany.ts b/src/random/randomCompany.ts new file mode 100644 index 0000000..99ad632 --- /dev/null +++ b/src/random/randomCompany.ts @@ -0,0 +1,13 @@ +import { + COMPANY_NAME_SAMPLES, + Company, + VAT_REGISTRATION_NUMBER_SAMPLES, +} from "../constants/companies"; +import { randomArrayItem } from "./randomArrayItem"; + +export const randomCompany = (): Company => { + return { + name: randomArrayItem(COMPANY_NAME_SAMPLES), + vatRegNumber: randomArrayItem(VAT_REGISTRATION_NUMBER_SAMPLES), + }; +}; diff --git a/src/random/randomPhoneNumber.ts b/src/random/randomPhoneNumber.ts new file mode 100644 index 0000000..290f3f3 --- /dev/null +++ b/src/random/randomPhoneNumber.ts @@ -0,0 +1,6 @@ +import { PHONE_NUMBER_SAMPLES } from "../constants/phoneNumbers"; +import { randomArrayItem } from "./randomArrayItem"; + +export const randomPhoneNumber = () => { + return randomArrayItem(PHONE_NUMBER_SAMPLES); +};