diff options
| author | Shinigami <[email protected]> | 2022-01-19 16:58:23 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-19 16:58:23 +0100 |
| commit | 61d02960a9132fa2c4d4d7259883b2e944233bb9 (patch) | |
| tree | c6708f06fe18a9f54c5d4ee1c529cfb456c7eba9 /src/index.ts | |
| parent | ae5992039da10fa3f5433f6bfc0e65bc351684fc (diff) | |
| download | faker-61d02960a9132fa2c4d4d7259883b2e944233bb9.tar.xz faker-61d02960a9132fa2c4d4d7259883b2e944233bb9.zip | |
fix: ts support for locales (#169)
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 168 |
1 files changed, 166 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts index c19e9567..f262601d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,8 +24,170 @@ import { Unique } from './unique'; import { Vehicle } from './vehicle'; import { Word } from './word'; +export interface LocaleDefinition { + title: string; + separator?: string; + + address?: Partial<{ + building_number: any[]; + city_name: any[]; + city_prefix: any[]; + city_suffix: any[]; + city: any[]; + country_code_alpha_3: any[]; + country_code: any[]; + country: any[]; + county: any[]; + default_country: any[]; + direction_abbr: any[]; + direction: any[]; + postcode_by_state: any[]; + postcode: any[]; + secondary_address: any[]; + state_abbr: any[]; + state: any[]; + street_address: any[]; + street_name: any[]; + street_suffix: any[]; + time_zone: any[]; + }>; + animal?: Partial<{ + bear: any[]; + bird: any[]; + cat: any[]; + cetacean: any[]; + cow: any[]; + crocodilia: any[]; + dog: any[]; + fish: any[]; + horse: any[]; + insect: any[]; + lion: any[]; + rabbit: any[]; + snake: any[]; + type: any[]; + }>; + app?: Partial<{ + author: any[]; + name: any[]; + version: any[]; + }>; + business?: Partial<{ + credit_card_expiry_dates: any[]; + credit_card_numbers: any[]; + credit_card_types: any[]; + }>; + cell_phone?: Partial<{ + formats: any[]; + }>; + commerce?: Partial<{ + color: any[]; + department: any[]; + product_description: any[]; + product_name: any[]; + }>; + company?: Partial<{ + adjective: any[]; + bs_adjective: any[]; + bs_noun: any[]; + bs_verb: any[]; + descriptor: any[]; + name: any[]; + noun: any[]; + suffix: any[]; + }>; + database?: Partial<{ + collation: any[]; + column: any[]; + engine: any[]; + type: any[]; + }>; + date?: Partial<{ + month: any[]; + weekday: any[]; + }>; + finance?: Partial<{ + account_type: any[]; + credit_card: any[]; + currency: any[]; + transaction_type: any[]; + }>; + hacker?: Partial<{ + abbreviation: any[]; + adjective: any[]; + ingverb: any[]; + noun: any[]; + phrase: any[]; + verb: any[]; + }>; + internet?: Partial<{ + avatar_uri: any[]; + domain_suffix: any[]; + example_email: any[]; + free_email: any[]; + }>; + lorem?: Partial<{ + supplemental: any[]; + words: any[]; + }>; + music?: Partial<{ + genre: any[]; + }>; + name?: Partial<{ + binary_gender: string[]; + female_first_name: string[]; + female_last_name: string[]; + female_middle_name: string[]; + female_prefix: string[]; + first_name: string[]; + gender: string[]; + last_name: string[]; + male_first_name: string[]; + male_last_name: string[]; + male_middle_name: string[]; + male_prefix: string[]; + name: string[]; + prefix: string[]; + suffix: string[]; + title: { + descriptor?: string[]; + job: string[]; + level?: string[]; + }; + }>; + phone_number?: Partial<{ + formats: any[]; + }>; + system?: Partial<{ + directoryPaths: any[]; + mimeTypes: any[]; + }>; + team?: Partial<{ + creature: any[]; + name: any[]; + }>; + vehicle?: Partial<{ + bicycle: any[]; + fuel: any[]; + manufacturer: any[]; + model: any[]; + type: any[]; + }>; + word?: Partial<{ + adjective: any[]; + adverb: any[]; + conjunction: any[]; + interjection: any[]; + noun: any[]; + preposition: any[]; + verb: any[]; + }>; +} + export interface FakerOptions { - locales?: string[]; + locales?: { + [locale: string]: LocaleDefinition; + }; locale?: string; localeFallback?: string; } @@ -52,7 +214,9 @@ export interface DefinitionTypes { } export class Faker { - locales: string[] | {}; + locales: { + [locale: string]: LocaleDefinition; + }; locale: string; localeFallback: string; |
