Skip to content

Commit

Permalink
Merge branch 'next' into update-eslint-define-config
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Nov 20, 2023
2 parents 93aa8f3 + 0ee1c67 commit 14d8098
Show file tree
Hide file tree
Showing 13 changed files with 210 additions and 181 deletions.
2 changes: 2 additions & 0 deletions src/locales/fr/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { PersonDefinition } from '../../..';
import female_first_name from './female_first_name';
import female_prefix from './female_prefix';
import first_name from './first_name';
import job_title_pattern from './job_title_pattern';
import last_name from './last_name';
import last_name_pattern from './last_name_pattern';
import male_first_name from './male_first_name';
Expand All @@ -19,6 +20,7 @@ const person: PersonDefinition = {
female_first_name,
female_prefix,
first_name,
job_title_pattern,
last_name,
last_name_pattern,
male_first_name,
Expand Down
3 changes: 3 additions & 0 deletions src/locales/fr/person/job_title_pattern.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default [
'{{person.jobType}} {{person.jobArea}} {{person.jobDescriptor}}',
];
52 changes: 52 additions & 0 deletions src/locales/fr/person/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,56 @@ export default {
'Agent',
'Stagiaire',
],
descriptor: [
'central',
'client',
'direct',
'futur',
'humain',
'international',
'interne',
'mondial',
'national',
'principal',
'régional',
],
level: [
'de configuration',
'de division',
'de groupe',
'de la communication',
'de la création',
'de la marque',
'de la mise en œuvre',
'de la mobilité',
'de la qualité',
'de la réponse',
'de la responsabilité',
'de la sécurité',
'de la tactique',
'de marque',
'de paradigme',
'de programme',
'de recherche',
'des applications',
'des comptes',
'des directives',
'des données',
'des facteurs',
'des fonctionnalités',
'des infrastructures',
'des interactions',
'des marchés',
'des métriques',
'des opérations',
'des solutions',
'du marketing',
'du web',
"de l'assurance",
"de l'identité",
"de l'intégration",
"de l'intranet",
"de l'optimisation",
"de l'utilisabilité",
],
};
2 changes: 0 additions & 2 deletions src/locales/fr_BE/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import male_prefix from './male_prefix';
import name_ from './name';
import prefix from './prefix';
import suffix from './suffix';
import title from './title';

const person: PersonDefinition = {
female_first_name,
Expand All @@ -28,7 +27,6 @@ const person: PersonDefinition = {
name: name_,
prefix,
suffix,
title,
};

export default person;
22 changes: 0 additions & 22 deletions src/locales/fr_BE/person/title.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/locales/fr_CH/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import male_prefix from './male_prefix';
import name_ from './name';
import prefix from './prefix';
import sex from './sex';
import title from './title';

const person: PersonDefinition = {
female_first_name,
Expand All @@ -26,7 +25,6 @@ const person: PersonDefinition = {
name: name_,
prefix,
sex,
title,
};

export default person;
22 changes: 0 additions & 22 deletions src/locales/fr_CH/person/title.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/modules/finance/iban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ const iban: Iban = {
total: 24,
bban: [
{
type: 'c',
type: 'a',
count: 4,
},
{
Expand Down
61 changes: 40 additions & 21 deletions src/modules/internet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.email() // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne'}) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne'}) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev', allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
Expand Down Expand Up @@ -107,7 +109,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.email() // '[email protected]'
* faker.internet.email('Jeanne', 'Doe') // '[email protected]'
* faker.internet.email('Jeanne') // '[email protected]'
* faker.internet.email('Jeanne') // '[email protected]'
* faker.internet.email('Jeanne', 'Doe') // '[email protected]'
* faker.internet.email('Jeanne', 'Doe', 'example.fakerjs.dev') // '[email protected]'
* faker.internet.email('Jeanne', 'Doe', 'example.fakerjs.dev', { allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
Expand Down Expand Up @@ -145,7 +149,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.email() // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev' }) // '[email protected]'
* faker.internet.email({ firstName: 'Jeanne', lastName: 'Doe', provider: 'example.fakerjs.dev', allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
Expand Down Expand Up @@ -248,8 +254,8 @@ export class InternetModule extends ModuleBase {
}

const {
firstName = this.faker.person.firstName(),
lastName = legacyLastName ?? this.faker.person.lastName(),
firstName,
lastName = legacyLastName,
provider = legacyProvider ??
this.faker.helpers.arrayElement(
this.faker.definitions.internet.free_email
Expand Down Expand Up @@ -295,7 +301,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.exampleEmail() // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe', allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
* @since 3.1.0
Expand Down Expand Up @@ -331,7 +339,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.exampleEmail() // '[email protected]'
* faker.internet.exampleEmail('Jeanne', 'Doe') // '[email protected]'
* faker.internet.exampleEmail('Jeanne') // '[email protected]'
* faker.internet.exampleEmail('Jeanne') // '[email protected]'
* faker.internet.exampleEmail('Jeanne', 'Doe') // '[email protected]'
* faker.internet.exampleEmail('Jeanne', 'Doe', { allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
* @since 3.1.0
Expand Down Expand Up @@ -365,7 +375,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.exampleEmail() // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe' }) // '[email protected]'
* faker.internet.exampleEmail({ firstName: 'Jeanne', lastName: 'Doe', allowSpecialCharacters: true }) // 'Jeanne%[email protected]'
*
* @since 3.1.0
Expand Down Expand Up @@ -454,8 +466,8 @@ export class InternetModule extends ModuleBase {
}

const {
firstName = this.faker.person.firstName(),
lastName = legacyLastName ?? this.faker.person.lastName(),
firstName,
lastName = legacyLastName,
allowSpecialCharacters = legacyOptions?.allowSpecialCharacters ?? false,
} = options;

Expand Down Expand Up @@ -485,7 +497,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.userName() // 'Nettie_Zboncak40'
* faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne98' - note surname is not used
* faker.internet.userName({ firstName: 'Jeanne' }) // 'Jeanne98'
* faker.internet.userName({ firstName: 'Jeanne' }) // 'Jeanne.Smith98'
* faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne_Doe98'
* faker.internet.userName({ firstName: 'John', lastName: 'Doe' }) // 'John.Doe'
* faker.internet.userName({ firstName: 'Hélene', lastName: 'Müller' }) // 'Helene_Muller11'
* faker.internet.userName({ firstName: 'Фёдор', lastName: 'Достоевский' }) // 'Fedor.Dostoevskii50'
Expand Down Expand Up @@ -520,7 +534,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.userName() // 'Nettie_Zboncak40'
* faker.internet.userName('Jeanne', 'Doe') // 'Jeanne98' - note surname is not used
* faker.internet.userName('Jeanne') // 'Jeanne98'
* faker.internet.userName('Jeanne') // 'Jeanne.Smith98'
* faker.internet.userName('Jeanne', 'Doe') // 'Jeanne_Doe98'
* faker.internet.userName('John', 'Doe') // 'John.Doe'
* faker.internet.userName('Hélene', 'Müller') // 'Helene_Muller11'
* faker.internet.userName('Фёдор', 'Достоевский') // 'Fedor.Dostoevskii50'
Expand All @@ -546,7 +562,9 @@ export class InternetModule extends ModuleBase {
*
* @example
* faker.internet.userName() // 'Nettie_Zboncak40'
* faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne98' - note surname is not used
* faker.internet.userName({ firstName: 'Jeanne'}) // 'Jeanne98'
* faker.internet.userName({ firstName: 'Jeanne'}) // 'Jeanne.Smith98'
* faker.internet.userName({ firstName: 'Jeanne', lastName: 'Doe'}) // 'Jeanne_Doe98'
* faker.internet.userName({ firstName: 'John', lastName: 'Doe' }) // 'John.Doe'
* faker.internet.userName({ firstName: 'Hélene', lastName: 'Müller' }) // 'Helene_Muller11'
* faker.internet.userName({ firstName: 'Фёдор', lastName: 'Достоевский' }) // 'Fedor.Dostoevskii50'
Expand Down Expand Up @@ -608,23 +626,24 @@ export class InternetModule extends ModuleBase {
const {
firstName = this.faker.person.firstName(),
lastName = legacyLastName ?? this.faker.person.lastName(),
lastName: hasLastName = legacyLastName,
} = options;

let result: string;
switch (this.faker.number.int(2)) {
const strategy = this.faker.number.int(hasLastName ? 1 : 2);
const separator = this.faker.helpers.arrayElement(['.', '_']);
switch (strategy) {
case 0:
result = `${firstName}${this.faker.number.int(99)}`;
result = `${firstName}${separator}${lastName}${this.faker.number.int(
99
)}`;
break;
case 1:
result =
firstName + this.faker.helpers.arrayElement(['.', '_']) + lastName;
result = `${firstName}${separator}${lastName}`;
break;
case 2:
default:
result = `${firstName}${this.faker.helpers.arrayElement([
'.',
'_',
])}${lastName}${this.faker.number.int(99)}`;
result = `${firstName}${this.faker.number.int(99)}`;
break;
}

Expand Down
6 changes: 3 additions & 3 deletions test/all-functional.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ const BROKEN_LOCALE_METHODS = {
person: {
prefix: ['az', 'id_ID', 'ru', 'zh_CN', 'zh_TW'],
suffix: ['az', 'it', 'mk', 'pt_PT', 'ro_MD', 'ru'],
jobArea: ['ar', 'fr', 'fr_BE', 'fr_CA', 'fr_CH', 'fr_LU', 'fr_SN'],
jobDescriptor: ['ar', 'fr', 'fr_BE', 'fr_CA', 'fr_CH', 'fr_LU', 'fr_SN'],
jobTitle: ['ar', 'fr', 'fr_BE', 'fr_CA', 'fr_CH', 'fr_LU', 'ur', 'fr_SN'],
jobArea: ['ar'],
jobDescriptor: ['ar'],
jobTitle: ['ar', 'ur'],
jobType: ['ur'],
},
} satisfies {
Expand Down
Loading

0 comments on commit 14d8098

Please sign in to comment.