diff --git a/src/definitions/person.ts b/src/definitions/person.ts index 773d4fb849c..b6096e81e2f 100644 --- a/src/definitions/person.ts +++ b/src/definitions/person.ts @@ -26,9 +26,9 @@ export type PersonDefinitions = LocaleEntry<{ suffix: string[]; /** - * A list of patterns used to generate names. + * A weighted list of patterns used to generate names. */ - name: string[]; + name: Array<{ value: string; weight: number }>; bio_patterns?: string[]; diff --git a/src/locales/ar/person/name.ts b/src/locales/ar/person/name.ts index 81f3b1e489a..bd69e768928 100644 --- a/src/locales/ar/person/name.ts +++ b/src/locales/ar/person/name.ts @@ -1,5 +1,8 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.last_name}} {{person.first_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 5 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 5 }, ]; diff --git a/src/locales/az/person/name.ts b/src/locales/az/person/name.ts index afecc403f09..1018fe75cee 100644 --- a/src/locales/az/person/name.ts +++ b/src/locales/az/person/name.ts @@ -1,8 +1,5 @@ export default [ - '{{person.male_first_name}}', - '{{person.male_last_name}} {{person.male_first_name}}', - '{{person.male_first_name}} {{person.male_last_name}}', - '{{person.female_first_name}}', - '{{person.female_first_name}} {{person.female_last_name}}', - '{{person.female_last_name}} {{person.female_first_name}}', + { value: '{{person.firstName}}', weight: 1 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, ]; diff --git a/src/locales/cz/person/name.ts b/src/locales/cz/person/name.ts index e06caa3ac67..eb76dabb32d 100644 --- a/src/locales/cz/person/name.ts +++ b/src/locales/cz/person/name.ts @@ -1,8 +1,11 @@ export default [ - '{{person.prefix}} {{person.male_first_name}} {{person.male_last_name}}', - '{{person.prefix}} {{person.female_first_name}} {{person.female_last_name}}', - '{{person.male_first_name}} {{person.male_last_name}} {{person.suffix}}', - '{{person.female_first_name}} {{person.female_last_name}} {{person.suffix}}', - '{{person.male_first_name}} {{person.male_last_name}}', - '{{person.female_first_name}} {{person.female_last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/de/person/name.ts b/src/locales/de/person/name.ts index fd40e987457..3e779a47416 100644 --- a/src/locales/de/person/name.ts +++ b/src/locales/de/person/name.ts @@ -1,7 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.nobility_title_prefix}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 9 }, ]; diff --git a/src/locales/de_AT/person/name.ts b/src/locales/de_AT/person/name.ts index 011fae52816..2b844dc786a 100644 --- a/src/locales/de_AT/person/name.ts +++ b/src/locales/de_AT/person/name.ts @@ -1,5 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.nobility_title_prefix}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 5 }, ]; diff --git a/src/locales/de_CH/person/name.ts b/src/locales/de_CH/person/name.ts index 6d951dfc8fc..3ed8a80c86e 100644 --- a/src/locales/de_CH/person/name.ts +++ b/src/locales/de_CH/person/name.ts @@ -1 +1,3 @@ -export default ['{{person.first_name}} {{person.last_name}}']; +export default [ + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, +]; diff --git a/src/locales/dv/person/name.ts b/src/locales/dv/person/name.ts index 66884dd81fd..3ed8a80c86e 100644 --- a/src/locales/dv/person/name.ts +++ b/src/locales/dv/person/name.ts @@ -1,5 +1,3 @@ export default [ - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.male_last_name}}', - '{{person.female_first_name}} {{person.female_last_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, ]; diff --git a/src/locales/el/person/name.ts b/src/locales/el/person/name.ts index 8cee34fa23d..eb76dabb32d 100644 --- a/src/locales/el/person/name.ts +++ b/src/locales/el/person/name.ts @@ -1,5 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/en/person/name.ts b/src/locales/en/person/name.ts index 28a268c490f..772af2a946d 100644 --- a/src/locales/en/person/name.ts +++ b/src/locales/en/person/name.ts @@ -1,7 +1,16 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 49 }, + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 7, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 7, + }, + { + value: + '{{person.prefix}} {{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, ]; diff --git a/src/locales/en_GH/person/name.ts b/src/locales/en_GH/person/name.ts index 40cb9edc363..b0892e31545 100644 --- a/src/locales/en_GH/person/name.ts +++ b/src/locales/en_GH/person/name.ts @@ -1,6 +1,7 @@ export default [ - '{{person.female_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}-{{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}-{{person.last_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, + { + value: '{{person.firstName}} {{person.lastName}}-{{person.lastName}}', + weight: 1, + }, ]; diff --git a/src/locales/en_NG/person/name.ts b/src/locales/en_NG/person/name.ts index ed50851497d..d74085574db 100644 --- a/src/locales/en_NG/person/name.ts +++ b/src/locales/en_NG/person/name.ts @@ -1,4 +1,4 @@ export default [ - '{{person.first_name}} {{person.last_name}}', - '{{person.last_name}} {{person.first_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, ]; diff --git a/src/locales/en_ZA/person/name.ts b/src/locales/en_ZA/person/name.ts index ed50851497d..d74085574db 100644 --- a/src/locales/en_ZA/person/name.ts +++ b/src/locales/en_ZA/person/name.ts @@ -1,4 +1,4 @@ export default [ - '{{person.first_name}} {{person.last_name}}', - '{{person.last_name}} {{person.first_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, ]; diff --git a/src/locales/es/person/name.ts b/src/locales/es/person/name.ts index 45752dd65aa..68a1d1f787b 100644 --- a/src/locales/es/person/name.ts +++ b/src/locales/es/person/name.ts @@ -1,4 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.last_name}}', + { + value: + '{{person.prefix}} {{person.firstName}} {{person.lastName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.lastName}}', + weight: 9, + }, ]; diff --git a/src/locales/es_MX/person/name.ts b/src/locales/es_MX/person/name.ts index e6032d2d8f1..7253fc0f04e 100644 --- a/src/locales/es_MX/person/name.ts +++ b/src/locales/es_MX/person/name.ts @@ -1,6 +1,20 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} de {{person.last_name}}', - '{{person.suffix}} {{person.first_name}} {{person.last_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.last_name}}', + { + value: + '{{person.prefix}} {{person.firstName}} {{person.lastName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} de {{person.lastName}}', + weight: 3, + }, + { + value: + '{{person.suffix}} {{person.firstName}} {{person.lastName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.lastName}}', + weight: 5, + }, ]; diff --git a/src/locales/fa/person/name.ts b/src/locales/fa/person/name.ts index 482cbd41af9..3e779a47416 100644 --- a/src/locales/fa/person/name.ts +++ b/src/locales/fa/person/name.ts @@ -1,6 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 9 }, ]; diff --git a/src/locales/fi/person/name.ts b/src/locales/fi/person/name.ts index 34f0370d18d..3ed8a80c86e 100644 --- a/src/locales/fi/person/name.ts +++ b/src/locales/fi/person/name.ts @@ -1,5 +1,3 @@ export default [ - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, ]; diff --git a/src/locales/fr/person/name.ts b/src/locales/fr/person/name.ts index 81f3b1e489a..95becffad7e 100644 --- a/src/locales/fr/person/name.ts +++ b/src/locales/fr/person/name.ts @@ -1,5 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.last_name}} {{person.first_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 2, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/fr_BE/person/name.ts b/src/locales/fr_BE/person/name.ts index 28a268c490f..eb76dabb32d 100644 --- a/src/locales/fr_BE/person/name.ts +++ b/src/locales/fr_BE/person/name.ts @@ -1,7 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/fr_CH/person/name.ts b/src/locales/fr_CH/person/name.ts index 81f3b1e489a..95becffad7e 100644 --- a/src/locales/fr_CH/person/name.ts +++ b/src/locales/fr_CH/person/name.ts @@ -1,5 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.last_name}} {{person.first_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 2, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/ge/person/name.ts b/src/locales/ge/person/name.ts index 2e536501d0a..3e779a47416 100644 --- a/src/locales/ge/person/name.ts +++ b/src/locales/ge/person/name.ts @@ -1,4 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 9 }, ]; diff --git a/src/locales/he/person/name.ts b/src/locales/he/person/name.ts index 482cbd41af9..3e779a47416 100644 --- a/src/locales/he/person/name.ts +++ b/src/locales/he/person/name.ts @@ -1,6 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 9 }, ]; diff --git a/src/locales/hr/person/name.ts b/src/locales/hr/person/name.ts index 740b0642c74..02a6fdf5273 100644 --- a/src/locales/hr/person/name.ts +++ b/src/locales/hr/person/name.ts @@ -1,7 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}, {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}}, {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/hu/person/name.ts b/src/locales/hu/person/name.ts index 0a6c8d5255d..019fb596118 100644 --- a/src/locales/hu/person/name.ts +++ b/src/locales/hu/person/name.ts @@ -1,4 +1,7 @@ export default [ - '{{person.prefix}} {{person.last_name}} {{person.first_name}}', - '{{person.last_name}} {{person.first_name}}', + { + value: '{{person.prefix}} {{person.lastName}} {{person.firstName}}', + weight: 1, + }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 9 }, ]; diff --git a/src/locales/hy/person/name.ts b/src/locales/hy/person/name.ts index 28a268c490f..eb76dabb32d 100644 --- a/src/locales/hy/person/name.ts +++ b/src/locales/hy/person/name.ts @@ -1,7 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/id_ID/person/name.ts b/src/locales/id_ID/person/name.ts index fefc263e8d8..94ea3a29037 100644 --- a/src/locales/id_ID/person/name.ts +++ b/src/locales/id_ID/person/name.ts @@ -1,9 +1,8 @@ export default [ - '{{person.male_first_name}} {{person.male_last_name}}', - '{{person.male_last_name}} {{person.male_first_name}}', - '{{person.male_first_name}} {{person.male_first_name}} {{person.male_last_name}}', - '{{person.female_first_name}} {{person.female_last_name}}', - '{{person.female_first_name}} {{person.male_last_name}}', - '{{person.female_last_name}} {{person.female_first_name}}', - '{{person.female_first_name}} {{person.female_first_name}} {{person.female_last_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, + { + value: '{{person.firstName}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, ]; diff --git a/src/locales/it/person/name.ts b/src/locales/it/person/name.ts index 482cbd41af9..3e779a47416 100644 --- a/src/locales/it/person/name.ts +++ b/src/locales/it/person/name.ts @@ -1,6 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 9 }, ]; diff --git a/src/locales/ja/person/name.ts b/src/locales/ja/person/name.ts index 3558edaf2c6..75688dbd037 100644 --- a/src/locales/ja/person/name.ts +++ b/src/locales/ja/person/name.ts @@ -1 +1,3 @@ -export default ['{{person.last_name}} {{person.first_name}}']; +export default [ + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, +]; diff --git a/src/locales/ko/person/name.ts b/src/locales/ko/person/name.ts index 3558edaf2c6..75688dbd037 100644 --- a/src/locales/ko/person/name.ts +++ b/src/locales/ko/person/name.ts @@ -1 +1,3 @@ -export default ['{{person.last_name}} {{person.first_name}}']; +export default [ + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, +]; diff --git a/src/locales/lv/person/name.ts b/src/locales/lv/person/name.ts index 55bf8bffe08..492a7e6fd3c 100644 --- a/src/locales/lv/person/name.ts +++ b/src/locales/lv/person/name.ts @@ -1,13 +1,20 @@ export default [ - '{{person.prefix}} {{person.male_first_name}} {{person.male_last_name}}', - '{{person.male_first_name}} {{person.male_last_name}}', - '{{person.male_last_name}} {{person.male_first_name}}', - '{{person.male_first_name}} {{person.male_first_name}} {{person.male_last_name}}', - '{{person.male_first_name}} {{person.male_last_name}}-{{person.male_last_name}}', - '{{person.prefix}} {{person.female_first_name}} {{person.female_last_name}}', - '{{person.female_first_name}} {{person.female_last_name}} {{person.suffix}}', - '{{person.female_first_name}} {{person.female_last_name}}', - '{{person.female_last_name}} {{person.female_first_name}}', - '{{person.female_first_name}} {{person.female_first_name}} {{person.female_last_name}}', - '{{person.female_first_name}} {{person.female_last_name}}-{{person.female_last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 7 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 2 }, + { + value: '{{person.firstName}} {{person.firstName}} {{person.lastName}}', + weight: 2, + }, + { + value: '{{person.firstName}} {{person.lastName}}-{{person.lastName}}', + weight: 2, + }, ]; diff --git a/src/locales/mk/person/name.ts b/src/locales/mk/person/name.ts index 9a2cbe859f1..b5a91accfae 100644 --- a/src/locales/mk/person/name.ts +++ b/src/locales/mk/person/name.ts @@ -1,6 +1,7 @@ export default [ - '{{person.female_prefix}} {{person.female_first_name}} {{person.female_last_name}}', - '{{person.male_prefix}} {{person.male_first_name}} {{person.male_last_name}}', - '{{person.female_first_name}} {{person.female_last_name}}', - '{{person.male_first_name}} {{person.male_last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/nb_NO/person/name.ts b/src/locales/nb_NO/person/name.ts index a0c4cc5e86b..3cfec1ea604 100644 --- a/src/locales/nb_NO/person/name.ts +++ b/src/locales/nb_NO/person/name.ts @@ -1,8 +1,19 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.female_first_name}} {{person.female_first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.male_first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/nl/person/name.ts b/src/locales/nl/person/name.ts index ab5165b6041..eb76dabb32d 100644 --- a/src/locales/nl/person/name.ts +++ b/src/locales/nl/person/name.ts @@ -1,6 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.tussenvoegsel}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/nl_BE/person/name.ts b/src/locales/nl_BE/person/name.ts index 8cee34fa23d..eb76dabb32d 100644 --- a/src/locales/nl_BE/person/name.ts +++ b/src/locales/nl_BE/person/name.ts @@ -1,5 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/pl/person/name.ts b/src/locales/pl/person/name.ts index 2e536501d0a..3e779a47416 100644 --- a/src/locales/pl/person/name.ts +++ b/src/locales/pl/person/name.ts @@ -1,4 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 9 }, ]; diff --git a/src/locales/pt_BR/person/name.ts b/src/locales/pt_BR/person/name.ts index 28a268c490f..eb76dabb32d 100644 --- a/src/locales/pt_BR/person/name.ts +++ b/src/locales/pt_BR/person/name.ts @@ -1,7 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/pt_PT/person/name.ts b/src/locales/pt_PT/person/name.ts index 98c6b8dbf1c..45b05d925a9 100644 --- a/src/locales/pt_PT/person/name.ts +++ b/src/locales/pt_PT/person/name.ts @@ -1,7 +1,7 @@ export default [ - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', - '{{person.male_prefix}} {{person.male_first_name}} {{person.last_name}}', - '{{person.female_prefix}} {{person.female_first_name}} {{person.last_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 9 }, + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, ]; diff --git a/src/locales/ro/person/name.ts b/src/locales/ro/person/name.ts index 761a6ec6243..3a8f55ef5c0 100644 --- a/src/locales/ro/person/name.ts +++ b/src/locales/ro/person/name.ts @@ -1,10 +1,8 @@ export default [ - '{{person.male_first_name}} {{person.last_name}}', - '{{person.last_name}} {{person.male_first_name}}', - '{{person.prefix}} {{person.male_first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}, {{person.suffix}}', - '{{person.prefix}} {{person.male_first_name}} {{person.last_name}}, {{person.suffix}}', - '{{person.female_first_name}} {{person.last_name}}', - '{{person.last_name}} {{person.female_first_name}}', - '{{person.prefix}} {{person.female_first_name}} {{person.last_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, ]; diff --git a/src/locales/ru/person/name.ts b/src/locales/ru/person/name.ts index c5189e48054..51793f935db 100644 --- a/src/locales/ru/person/name.ts +++ b/src/locales/ru/person/name.ts @@ -1,10 +1,12 @@ export default [ - '{{person.male_first_name}} {{person.male_last_name}}', - '{{person.male_last_name}} {{person.male_first_name}}', - '{{person.male_first_name}} {{person.male_middle_name}} {{person.male_last_name}}', - '{{person.male_last_name}} {{person.male_first_name}} {{person.male_middle_name}}', - '{{person.female_first_name}} {{person.female_last_name}}', - '{{person.female_last_name}} {{person.female_first_name}}', - '{{person.female_first_name}} {{person.female_middle_name}} {{person.female_last_name}}', - '{{person.female_last_name}} {{person.female_first_name}} {{person.female_middle_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, + { + value: '{{person.firstName}} {{person.middleName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.lastName}} {{person.firstName}} {{person.middleName}}', + weight: 1, + }, ]; diff --git a/src/locales/sk/person/name.ts b/src/locales/sk/person/name.ts index e06caa3ac67..eb76dabb32d 100644 --- a/src/locales/sk/person/name.ts +++ b/src/locales/sk/person/name.ts @@ -1,8 +1,11 @@ export default [ - '{{person.prefix}} {{person.male_first_name}} {{person.male_last_name}}', - '{{person.prefix}} {{person.female_first_name}} {{person.female_last_name}}', - '{{person.male_first_name}} {{person.male_last_name}} {{person.suffix}}', - '{{person.female_first_name}} {{person.female_last_name}} {{person.suffix}}', - '{{person.male_first_name}} {{person.male_last_name}}', - '{{person.female_first_name}} {{person.female_last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/sv/person/name.ts b/src/locales/sv/person/name.ts index b8314da3020..37334af61f1 100644 --- a/src/locales/sv/person/name.ts +++ b/src/locales/sv/person/name.ts @@ -1,8 +1,15 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.lastName}}', + weight: 1, + }, ]; diff --git a/src/locales/tr/person/name.ts b/src/locales/tr/person/name.ts index 482cbd41af9..b5a91accfae 100644 --- a/src/locales/tr/person/name.ts +++ b/src/locales/tr/person/name.ts @@ -1,6 +1,7 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/uk/person/name.ts b/src/locales/uk/person/name.ts index c5189e48054..51793f935db 100644 --- a/src/locales/uk/person/name.ts +++ b/src/locales/uk/person/name.ts @@ -1,10 +1,12 @@ export default [ - '{{person.male_first_name}} {{person.male_last_name}}', - '{{person.male_last_name}} {{person.male_first_name}}', - '{{person.male_first_name}} {{person.male_middle_name}} {{person.male_last_name}}', - '{{person.male_last_name}} {{person.male_first_name}} {{person.male_middle_name}}', - '{{person.female_first_name}} {{person.female_last_name}}', - '{{person.female_last_name}} {{person.female_first_name}}', - '{{person.female_first_name}} {{person.female_middle_name}} {{person.female_last_name}}', - '{{person.female_last_name}} {{person.female_first_name}} {{person.female_middle_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, + { value: '{{person.lastName}} {{person.firstName}}', weight: 1 }, + { + value: '{{person.firstName}} {{person.middleName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.lastName}} {{person.firstName}} {{person.middleName}}', + weight: 1, + }, ]; diff --git a/src/locales/ur/person/name.ts b/src/locales/ur/person/name.ts index a946985a015..eb76dabb32d 100644 --- a/src/locales/ur/person/name.ts +++ b/src/locales/ur/person/name.ts @@ -1,9 +1,11 @@ export default [ - '{{person.prefix}} {{person.first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}} {{person.suffix}}', - '{{person.first_name}} {{person.last_name}}', - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', - '{{person.male_first_name}} بن {{person.male_first_name}}', - '{{person.female_first_name}} بنت {{person.male_first_name}}', + { + value: '{{person.prefix}} {{person.firstName}} {{person.lastName}}', + weight: 1, + }, + { + value: '{{person.firstName}} {{person.lastName}} {{person.suffix}}', + weight: 1, + }, + { value: '{{person.firstName}} {{person.lastName}}', weight: 8 }, ]; diff --git a/src/locales/vi/person/name.ts b/src/locales/vi/person/name.ts index ac2a668eaef..3ed8a80c86e 100644 --- a/src/locales/vi/person/name.ts +++ b/src/locales/vi/person/name.ts @@ -1,5 +1,3 @@ export default [ - '{{person.male_first_name}} {{person.last_name}}', - '{{person.female_first_name}} {{person.last_name}}', - '{{person.first_name}} {{person.last_name}}', + { value: '{{person.firstName}} {{person.lastName}}', weight: 1 }, ]; diff --git a/src/locales/zh_CN/person/name.ts b/src/locales/zh_CN/person/name.ts index 4052e58f31a..d661e1c84c2 100644 --- a/src/locales/zh_CN/person/name.ts +++ b/src/locales/zh_CN/person/name.ts @@ -1 +1,3 @@ -export default ['{{person.first_name}}{{person.last_name}}']; +export default [ + { value: '{{person.lastName}}{{person.firstName}}', weight: 1 }, +]; diff --git a/src/locales/zh_TW/person/name.ts b/src/locales/zh_TW/person/name.ts index 4052e58f31a..d661e1c84c2 100644 --- a/src/locales/zh_TW/person/name.ts +++ b/src/locales/zh_TW/person/name.ts @@ -1 +1,3 @@ -export default ['{{person.first_name}}{{person.last_name}}']; +export default [ + { value: '{{person.lastName}}{{person.firstName}}', weight: 1 }, +]; diff --git a/src/modules/person/index.ts b/src/modules/person/index.ts index 03609cbcabc..da30fee7c4e 100644 --- a/src/modules/person/index.ts +++ b/src/modules/person/index.ts @@ -187,27 +187,18 @@ export class PersonModule { lastName = this.lastName(sex), } = options; - const nameParts: string[] = []; - const prefix = this.faker.helpers.maybe(() => this.prefix(sex), { - probability: 0.125, - }); - - if (prefix) { - nameParts.push(prefix); - } - - nameParts.push(firstName); - nameParts.push(lastName); + const fullNamePattern: string = this.faker.helpers.weightedArrayElement( + this.faker.definitions.person.name + ); - const suffix = this.faker.helpers.maybe(() => this.suffix(), { - probability: 0.125, + const fullName = this.faker.helpers.mustache(fullNamePattern, { + 'person.prefix': () => this.prefix(sex), + 'person.firstName': () => firstName, + 'person.middleName': () => this.middleName(sex), + 'person.lastName': () => lastName, + 'person.suffix': () => this.suffix(), }); - - if (suffix) { - nameParts.push(suffix); - } - - return nameParts.join(' '); + return fullName; } /** diff --git a/test/__snapshots__/git.spec.ts.snap b/test/__snapshots__/git.spec.ts.snap index 51a0c632fae..bdad5290c8a 100644 --- a/test/__snapshots__/git.spec.ts.snap +++ b/test/__snapshots__/git.spec.ts.snap @@ -51,28 +51,28 @@ exports[`git > 1211 > commitDate > with only string refDate 1`] = `"Tue Dec 31 0 exports[`git > 1211 > commitEntry > with only Date refDate 1`] = ` "commit adb42f0e3f4a973fab0aeefce96dfcf49cd438df -Author: Imani Runolfsson -Date: Tue Dec 31 10:07:32 2019 -0400 +Author: Imani Runolfsson +Date: Tue Dec 31 20:11:06 2019 -0600 -    override wireless interface +    quantify virtual microchip " `; exports[`git > 1211 > commitEntry > with only number refDate 1`] = ` "commit adb42f0e3f4a973fab0aeefce96dfcf49cd438df -Author: Imani Runolfsson -Date: Tue Dec 31 10:07:32 2019 -0400 +Author: Imani Runolfsson +Date: Tue Dec 31 20:11:06 2019 -0600 -    override wireless interface +    quantify virtual microchip " `; exports[`git > 1211 > commitEntry > with only string refDate 1`] = ` "commit adb42f0e3f4a973fab0aeefce96dfcf49cd438df -Author: Imani Runolfsson -Date: Tue Dec 31 10:07:32 2019 -0400 +Author: Imani Runolfsson +Date: Tue Dec 31 20:11:06 2019 -0600 -    override wireless interface +    quantify virtual microchip " `; @@ -92,28 +92,28 @@ exports[`git > 1337 > commitDate > with only string refDate 1`] = `"Tue Dec 31 1 exports[`git > 1337 > commitEntry > with only Date refDate 1`] = ` "commit c346ba075bd57f5a62b82d72af39cbbb07a98cba -Author: Friedrich Dibbert -Date: Tue Dec 31 04:18:56 2019 -0700 +Author: Friedrich Dibbert +Date: Tue Dec 31 14:05:04 2019 +0800 -    reboot haptic capacitor +    override solid state firewall " `; exports[`git > 1337 > commitEntry > with only number refDate 1`] = ` "commit c346ba075bd57f5a62b82d72af39cbbb07a98cba -Author: Friedrich Dibbert -Date: Tue Dec 31 04:18:56 2019 -0700 +Author: Friedrich Dibbert +Date: Tue Dec 31 14:05:04 2019 +0800 -    reboot haptic capacitor +    override solid state firewall " `; exports[`git > 1337 > commitEntry > with only string refDate 1`] = ` "commit c346ba075bd57f5a62b82d72af39cbbb07a98cba -Author: Friedrich Dibbert -Date: Tue Dec 31 04:18:56 2019 -0700 +Author: Friedrich Dibbert +Date: Tue Dec 31 14:05:04 2019 +0800 -    reboot haptic capacitor +    override solid state firewall " `; diff --git a/test/__snapshots__/person.spec.ts.snap b/test/__snapshots__/person.spec.ts.snap index 3a4fbe85781..5a1ae8ca7d4 100644 --- a/test/__snapshots__/person.spec.ts.snap +++ b/test/__snapshots__/person.spec.ts.snap @@ -10,11 +10,11 @@ exports[`person > 42 > fullName > noArgs 1`] = `"Sadie Wiegand"`; exports[`person > 42 > fullName > with all (sex) 1`] = `"John Doe"`; -exports[`person > 42 > fullName > with firstName 1`] = `"John Schinner"`; +exports[`person > 42 > fullName > with firstName 1`] = `"John Schinner I"`; -exports[`person > 42 > fullName > with lastName 1`] = `"Sadie Doe"`; +exports[`person > 42 > fullName > with lastName 1`] = `"Sadie Doe I"`; -exports[`person > 42 > fullName > with sex 1`] = `"Melanie Schinner"`; +exports[`person > 42 > fullName > with sex 1`] = `"Melanie Schinner I"`; exports[`person > 42 > gender 1`] = `"Gender nonconforming"`; @@ -56,15 +56,15 @@ exports[`person > 1211 > firstName > noArgs 1`] = `"Tito"`; exports[`person > 1211 > firstName > with sex 1`] = `"Percy"`; -exports[`person > 1211 > fullName > noArgs 1`] = `"Claude Trantow"`; +exports[`person > 1211 > fullName > noArgs 1`] = `"Mr. Claude Trantow"`; -exports[`person > 1211 > fullName > with all (sex) 1`] = `"John Doe"`; +exports[`person > 1211 > fullName > with all (sex) 1`] = `"John Doe IV"`; -exports[`person > 1211 > fullName > with firstName 1`] = `"John Koelpin"`; +exports[`person > 1211 > fullName > with firstName 1`] = `"John Koelpin DDS"`; -exports[`person > 1211 > fullName > with lastName 1`] = `"Claude Doe"`; +exports[`person > 1211 > fullName > with lastName 1`] = `"Claude Doe DDS"`; -exports[`person > 1211 > fullName > with sex 1`] = `"Patti Koelpin"`; +exports[`person > 1211 > fullName > with sex 1`] = `"Patti Koelpin DDS"`; exports[`person > 1211 > gender 1`] = `"Trigender"`;