Skip to content

Commit

Permalink
Merge branch 'next' into infra/unicorn/prevent-abbreviations
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Dec 16, 2024
2 parents b717fb3 + e0016ad commit 5eb760f
Show file tree
Hide file tree
Showing 27 changed files with 701 additions and 730 deletions.
701 changes: 355 additions & 346 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/definitions/finance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ export type FinanceDefinition = LocaleEntry<{
* Types of transactions (e.g. `deposit`).
*/
transaction_type: string[];

/**
* The pattern used to generate transaction descriptions.
*/
transaction_description_pattern: string[];
}>;
5 changes: 5 additions & 0 deletions src/definitions/internet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@ export type InternetDefinition = LocaleEntry<{
http_status_code: Record<HTTPStatusCodeType, number[]>;

jwt_algorithm: string[];

/**
* List of user agent patterns.
*/
user_agent_pattern: string[];
}>;
8 changes: 8 additions & 0 deletions src/definitions/location.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Language } from '../modules/location';
import type { LocaleEntry } from './definitions';

/**
Expand Down Expand Up @@ -147,4 +148,11 @@ export type LocationDefinition = LocaleEntry<{
* @see [IANA Time Zone Database](https://www.iana.org/time-zones)
*/
time_zone: string[];

/**
* A list of spoken languages.
*
* @see [ISO 639-2 Language Code List](https://www.loc.gov/standards/iso639-2/php/code_list.php)
*/
language: Language[];
}>;
2 changes: 2 additions & 0 deletions src/locales/base/internet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import type { InternetDefinition } from '../../..';
import emoji from './emoji';
import http_status_code from './http_status_code';
import jwt_algorithm from './jwt_algorithm';
import user_agent_pattern from './user_agent_pattern';

const internet: InternetDefinition = {
emoji,
http_status_code,
jwt_algorithm,
user_agent_pattern,
};

export default internet;
22 changes: 22 additions & 0 deletions src/locales/base/internet/user_agent_pattern.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export default [
//typical IE user agent on Windows
'Mozilla/5.0 (compatible; MSIE {{number.int({"min":6,"max":10})}}.0; Windows NT {{helpers.arrayElement(["5.1","5.2","6.0","6.1","6.2","6.3","10.0"])}}; Trident/{{number.int({"min":4,"max":7})}}.0)',
//typical Edge user agent on Windows
'Mozilla/5.0 (Windows NT {{helpers.arrayElement(["5.1","5.2","6.0","6.1","6.2","6.3","10.0"])}}; Win64; x64) AppleWebKit/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}} (KHTML, like Gecko) Chrome/{{number.int({"min":55,"max":131})}}.{{system.semver}} Safari/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}} Edg/{{number.int({"min":110,"max":131})}}.{{system.semver}}',
//typical Safari user agent on MacOS
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}}.{{number.int({"min":0,"max":99})}} (KHTML, like Gecko) Version/16.1 Safari/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}}.{{number.int({"min":0,"max":99})}}',
//typical Firefox user agent on MacOS
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:{{number.int({"min":75, "max":133})}}.0) Gecko/20100101 Firefox/{{number.int({"min":75, "max":133})}}.0',
//typical Chrome user agent on MacOS
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_15_7) AppleWebKit/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}}.{{number.int({"min":0,"max":99})}} (KHTML, like Gecko) Chrome/{{number.int({"min":55,"max":131})}}.{{system.semver}} Safari/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}}.{{number.int({"min":0,"max":99})}}',
//typical Firefox user agent on Linux
'Mozilla/5.0 (X11; Linux x86_64; rv:{{number.int({"min":75,"max":133})}}.0) Gecko/20100101 Firefox/{{number.int({"min":75,"max":133})}}.0',
//typical user agent for a bot
'FakerBot/{{system.semver}}',
//typical Googlebot user agent
'Googlebot/2.1 (+http://www.google.com/bot.html)',
//typical Safari user agent on iOS
'Mozilla/5.0 (iPhone; CPU iPhone OS {{number.int({"min":10,"max":18})}}_{{number.int({"min":0,"max":4})}} like Mac OS X) AppleWebKit/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}}.{{number.int({"min":0,"max":99})}} (KHTML, like Gecko) Version/{{number.int({"min":10,"max":18})}}_{{number.int({"min":0,"max":4})}} Mobile/15E148 Safari/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}}',
//typical Chrome user agent on Android
'Mozilla/5.0 (Linux; Android {{number.int({"min":5,"max":13})}}; {{helpers.arrayElement(["SM-G998U","SM-G998B","SM-G998N","SM-G998P","SM-T800"])}}) AppleWebKit/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}} (KHTML, like Gecko) Chrome/{{number.int({"min":55,"max":131})}}.{{system.semver}} Mobile Safari/{{number.int({"min":536,"max":605})}}.{{number.int({"min":0,"max":99})}}',
];
12 changes: 12 additions & 0 deletions src/locales/de/animal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* This file is automatically generated.
* Run 'pnpm run generate:locales' to update.
*/
import type { AnimalDefinition } from '../../..';
import type_ from './type';

const animal: AnimalDefinition = {
type: type_,
};

export default animal;
46 changes: 46 additions & 0 deletions src/locales/de/animal/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export default [
'Adler',
'Affe',
'Biene',
'Bär',
'Delfin',
'Eichhörnchen',
'Eisbär',
'Elefant',
'Fisch',
'Flamingo',
'Fledermaus',
'Frosch',
'Fuchs',
'Gecko',
'Giraffe',
'Gorilla',
'Hai',
'Hamster',
'Hund',
'Kaninchen',
'Katze',
'Koala',
'Krokodil',
'Kuh',
'Känguru',
'Löwe',
'Nashorn',
'Nilpferd',
'Panda',
'Papagei',
'Pfau',
'Pferd',
'Pinguin',
'Reh',
'Schildkröte',
'Schlange',
'Schmetterling',
'Seelöwe',
'Strauß',
'Tiger',
'Vogel',
'Wal',
'Wolf',
'Zebra',
];
2 changes: 2 additions & 0 deletions src/locales/de/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Run 'pnpm run generate:locales' to update.
*/
import type { LocaleDefinition } from '../..';
import animal from './animal';
import cell_phone from './cell_phone';
import color from './color';
import company from './company';
Expand All @@ -23,6 +24,7 @@ import word from './word';
* - Endonym: Deutsch
*/
const de: LocaleDefinition = {
animal,
cell_phone,
color,
company,
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en/finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import type { FinanceDefinition } from '../../..';
import account_type from './account_type';
import credit_card from './credit_card';
import currency from './currency';
import transaction_description_pattern from './transaction_description_pattern';
import transaction_type from './transaction_type';

const finance: FinanceDefinition = {
account_type,
credit_card,
currency,
transaction_description_pattern,
transaction_type,
};

Expand Down
13 changes: 13 additions & 0 deletions src/locales/en/finance/transaction_description_pattern.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default [
'A {{finance.transactionType}} for {{finance.currencyCode}} {{finance.amount}} was made at {{company.name}} via card ending ****{{string.numeric(4)}} on account ***{{string.numeric(4)}}.',
'A {{finance.transactionType}} of {{finance.currencyCode}} {{finance.amount}} occurred at {{company.name}} using a card ending in ****{{string.numeric(4)}} for account ***{{string.numeric(4)}}.',
'Payment of {{finance.currencyCode}} {{finance.amount}} for {{finance.transactionType}} at {{company.name}}, processed with card ending ****{{string.numeric(4)}} linked to account ***{{string.numeric(4)}}.',
'Transaction alert: {{finance.transactionType}} at {{company.name}} using card ending ****{{string.numeric(4)}} for an amount of {{finance.currencyCode}} {{finance.amount}} on account ***{{string.numeric(4)}}.',
'You made a {{finance.transactionType}} of {{finance.currencyCode}} {{finance.amount}} at {{company.name}} using card ending in ****{{string.numeric(4)}} from account ***{{string.numeric(4)}}.',
'Your {{finance.transactionType}} of {{finance.currencyCode}} {{finance.amount}} at {{company.name}} was successful. Charged via card ****{{string.numeric(4)}} to account ***{{string.numeric(4)}}.',
'{{finance.transactionType}} at {{company.name}} with a card ending in ****{{string.numeric(4)}} for {{finance.currencyCode}} {{finance.amount}} from account ***{{string.numeric(4)}}.',
'{{finance.transactionType}} confirmed at {{company.name}} for {{finance.currencyCode}} {{finance.amount}}, card ending in ****{{string.numeric(4)}} associated with account ***{{string.numeric(4)}}.',
'{{finance.transactionType}} of {{finance.currencyCode}} {{finance.amount}} at {{company.name}} charged to account ending in {{string.numeric(4)}} using card ending in ****{{string.numeric(4)}}.',
'{{finance.transactionType}} processed at {{company.name}} for {{finance.currencyCode}} {{finance.amount}}, using card ending ****{{string.numeric(4)}}. Account: ***{{string.numeric(4)}}.',
'{{finance.transactionType}} transaction at {{company.name}} using card ending with ****{{string.numeric(4)}} for {{finance.currencyCode}} {{finance.amount}} in account ***{{string.numeric(4)}}.',
];
2 changes: 2 additions & 0 deletions src/locales/en/location/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import continent from './continent';
import country from './country';
import county from './county';
import direction from './direction';
import language from './language';
import postcode from './postcode';
import secondary_address from './secondary_address';
import state from './state';
Expand All @@ -31,6 +32,7 @@ const location: LocationDefinition = {
country,
county,
direction,
language,
postcode,
secondary_address,
state,
Expand Down
73 changes: 73 additions & 0 deletions src/locales/en/location/language.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
export default [
{ name: 'Afrikaans', alpha2: 'af', alpha3: 'afr' },
{ name: 'Azerbaijani', alpha2: 'az', alpha3: 'aze' },
{ name: 'Maldivian', alpha2: 'dv', alpha3: 'div' },
{ name: 'Farsi/Persian', alpha2: 'fa', alpha3: 'fas' },
{ name: 'Latvian', alpha2: 'lv', alpha3: 'lav' },
{ name: 'Indonesian', alpha2: 'id', alpha3: 'ind' },
{ name: 'Nepali', alpha2: 'ne', alpha3: 'nep' },
{ name: 'Thai', alpha2: 'th', alpha3: 'tha' },
{ name: 'Uzbek', alpha2: 'uz', alpha3: 'uzb' },
{ name: 'Yoruba', alpha2: 'yo', alpha3: 'yor' },
{ name: 'Pashto', alpha2: 'ps', alpha3: 'pus' },
{ name: 'English', alpha2: 'en', alpha3: 'eng' },
{ name: 'Urdu', alpha2: 'ur', alpha3: 'urd' },
{ name: 'German', alpha2: 'de', alpha3: 'deu' },
{ name: 'French', alpha2: 'fr', alpha3: 'fra' },
{ name: 'Spanish', alpha2: 'es', alpha3: 'spa' },
{ name: 'Italian', alpha2: 'it', alpha3: 'ita' },
{ name: 'Dutch', alpha2: 'nl', alpha3: 'nld' },
{ name: 'Russian', alpha2: 'ru', alpha3: 'rus' },
{ name: 'Portuguese', alpha2: 'pt', alpha3: 'por' },
{ name: 'Polish', alpha2: 'pl', alpha3: 'pol' },
{ name: 'Arabic', alpha2: 'ar', alpha3: 'ara' },
{ name: 'Japanese', alpha2: 'ja', alpha3: 'jpn' },
{ name: 'Chinese', alpha2: 'zh', alpha3: 'zho' },
{ name: 'Hindi', alpha2: 'hi', alpha3: 'hin' },
{ name: 'Bengali', alpha2: 'bn', alpha3: 'ben' },
{ name: 'Gujarati', alpha2: 'gu', alpha3: 'guj' },
{ name: 'Tamil', alpha2: 'ta', alpha3: 'tam' },
{ name: 'Telugu', alpha2: 'te', alpha3: 'tel' },
{ name: 'Punjabi', alpha2: 'pa', alpha3: 'pan' },
{ name: 'Vietnamese', alpha2: 'vi', alpha3: 'vie' },
{ name: 'Korean', alpha2: 'ko', alpha3: 'kor' },
{ name: 'Turkish', alpha2: 'tr', alpha3: 'tur' },
{ name: 'Swedish', alpha2: 'sv', alpha3: 'swe' },
{ name: 'Greek', alpha2: 'el', alpha3: 'ell' },
{ name: 'Czech', alpha2: 'cs', alpha3: 'ces' },
{ name: 'Hungarian', alpha2: 'hu', alpha3: 'hun' },
{ name: 'Romanian', alpha2: 'ro', alpha3: 'ron' },
{ name: 'Ukrainian', alpha2: 'uk', alpha3: 'ukr' },
{ name: 'Norwegian', alpha2: 'no', alpha3: 'nor' },
{ name: 'Serbian', alpha2: 'sr', alpha3: 'srp' },
{ name: 'Croatian', alpha2: 'hr', alpha3: 'hrv' },
{ name: 'Slovak', alpha2: 'sk', alpha3: 'slk' },
{ name: 'Slovenian', alpha2: 'sl', alpha3: 'slv' },
{ name: 'Icelandic', alpha2: 'is', alpha3: 'isl' },
{ name: 'Finnish', alpha2: 'fi', alpha3: 'fin' },
{ name: 'Danish', alpha2: 'da', alpha3: 'dan' },
{ name: 'Swahili', alpha2: 'sw', alpha3: 'swa' },
{ name: 'Bashkir', alpha2: 'ba', alpha3: 'bak' },
{ name: 'Basque', alpha2: 'eu', alpha3: 'eus' },
{ name: 'Catalan', alpha2: 'ca', alpha3: 'cat' },
{ name: 'Galician', alpha2: 'gl', alpha3: 'glg' },
{ name: 'Esperanto', alpha2: 'eo', alpha3: 'epo' },
{ name: 'Fijian', alpha2: 'fj', alpha3: 'fij' },
{ name: 'Malagasy', alpha2: 'mg', alpha3: 'mlg' },
{ name: 'Maltese', alpha2: 'mt', alpha3: 'mlt' },
{ name: 'Albanian', alpha2: 'sq', alpha3: 'sqi' },
{ name: 'Armenian', alpha2: 'hy', alpha3: 'hye' },
{ name: 'Georgian', alpha2: 'ka', alpha3: 'kat' },
{ name: 'Macedonian', alpha2: 'mk', alpha3: 'mkd' },
{ name: 'Kazakh', alpha2: 'kk', alpha3: 'kaz' },
{ name: 'Haitian Creole', alpha2: 'ht', alpha3: 'hat' },
{ name: 'Mongolian', alpha2: 'mn', alpha3: 'mon' },
{ name: 'Kyrgyz', alpha2: 'ky', alpha3: 'kir' },
{ name: 'Finnish', alpha2: 'fi', alpha3: 'fin' },
{ name: 'Tagalog', alpha2: 'tl', alpha3: 'tgl' },
{ name: 'Malay', alpha2: 'ms', alpha3: 'msa' },
{ name: 'Tajik', alpha2: 'tg', alpha3: 'tgk' },
{ name: 'Swati', alpha2: 'ss', alpha3: 'ssw' },
{ name: 'Tatar', alpha2: 'tt', alpha3: 'tat' },
{ name: 'Zulu', alpha2: 'zu', alpha3: 'zul' },
];
2 changes: 2 additions & 0 deletions src/locales/ur/location/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import city_prefix from './city_prefix';
import city_suffix from './city_suffix';
import country from './country';
import direction from './direction';
import language from './language';
import postcode from './postcode';
import secondary_address from './secondary_address';
import state from './state';
Expand All @@ -26,6 +27,7 @@ const location: LocationDefinition = {
city_suffix,
country,
direction,
language,
postcode,
secondary_address,
state,
Expand Down
33 changes: 33 additions & 0 deletions src/locales/ur/location/language.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export default [
{ name: 'پشتو', alpha2: 'ps', alpha3: 'pus' },
{ name: 'اردو', alpha2: 'ur', alpha3: 'urd' },
{ name: 'انگریزی', alpha2: 'en', alpha3: 'eng' },
{ name: 'جرمن', alpha2: 'de', alpha3: 'deu' },
{ name: 'فرانسیسی', alpha2: 'fr', alpha3: 'fra' },
{ name: 'اسپینش', alpha2: 'es', alpha3: 'spa' },
{ name: 'دچ', alpha2: 'nl', alpha3: 'nld' },
{ name: 'روسی', alpha2: 'ru', alpha3: 'rus' },
{ name: 'پرتگالی', alpha2: 'pt', alpha3: 'por' },
{ name: 'پولش', alpha2: 'pl', alpha3: 'pol' },
{ name: 'عربی', alpha2: 'ar', alpha3: 'ara' },
{ name: 'جاپانی', alpha2: 'ja', alpha3: 'jpn' },
{ name: 'چینی', alpha2: 'zh', alpha3: 'zho' },
{ name: 'ہندی', alpha2: 'hi', alpha3: 'hin' },
{ name: 'بنگالی', alpha2: 'bn', alpha3: 'ben' },
{ name: 'تمل', alpha2: 'ta', alpha3: 'tam' },
{ name: 'تلگو', alpha2: 'te', alpha3: 'tel' },
{ name: 'پنجابی', alpha2: 'pa', alpha3: 'pan' },
{ name: 'ترکی', alpha2: 'tr', alpha3: 'tur' },
{ name: 'سویڈش', alpha2: 'sv', alpha3: 'swe' },
{ name: 'یونانی', alpha2: 'el', alpha3: 'ell' },
{ name: 'چیک', alpha2: 'cs', alpha3: 'ces' },
{ name: 'ہنگرین', alpha2: 'hu', alpha3: 'hun' },
{ name: 'نارویجن', alpha2: 'no', alpha3: 'nor' },
{ name: 'کروشیائی', alpha2: 'hr', alpha3: 'hrv' },
{ name: 'سلوواک', alpha2: 'sk', alpha3: 'slk' },
{ name: 'سلووینیائی', alpha2: 'sl', alpha3: 'slv' },
{ name: 'فنش', alpha2: 'fi', alpha3: 'fin' },
{ name: 'دنش', alpha2: 'da', alpha3: 'dan' },
{ name: 'مالٹی', alpha2: 'mt', alpha3: 'mlt' },
{ name: 'تاجک', alpha2: 'tg', alpha3: 'tgk' },
];
13 changes: 4 additions & 9 deletions src/modules/finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -969,18 +969,13 @@ export class FinanceModule extends ModuleBase {
*
* @example
* faker.finance.transactionDescription()
* // 'invoice transaction at Kilback - Durgan using card ending with ************4316 for UAH 783.82 in account ***16168663'
* // 'payment transaction at Emard LLC using card ending with ****9187 for HNL 506.57 in account ***2584.'
*
* @since 5.1.0
*/
transactionDescription(): string {
const amount = this.amount();
const company = this.faker.company.name();
const transactionType = this.transactionType();
const account = this.accountNumber();
const card = this.creditCardNumber().replaceAll(/.(?=.{4})/g, '*');
const currency = this.currencyCode();

return `${transactionType} transaction at ${company} using card ending with ${card} for ${currency} ${amount} in account ***${account}`;
return this.faker.helpers.fake(
this.faker.definitions.finance.transaction_description_pattern
);
}
}
Loading

0 comments on commit 5eb760f

Please sign in to comment.