Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(person)!: flatten jobs definitions #2505

Merged
merged 11 commits into from
Feb 27, 2024
3 changes: 3 additions & 0 deletions docs/guide/upgrading_v9/2505.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Jobs definitions reorganized

The locale definitions used by `faker.person.jobTitle()`, `faker.person.jobDescriptor()`, `faker.person.jobArea()` and `faker.person.jobType()` have been reorganized and are no longer nested under `definitions.person.title`. If you are using the public methods, no changes are required. You only need to change your code if you are accessing the raw definitions e.g. in `faker.helpers.fake()`.
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion src/definitions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
export type { LoremDefinition } from './lorem';
export type { MetadataDefinition } from './metadata';
export type { MusicDefinition } from './music';
export type { PersonDefinition, PersonTitleDefinition } from './person';
export type { PersonDefinition } from './person';

Check warning on line 19 in src/definitions/index.ts

View check run for this annotation

Codecov / codecov/patch

src/definitions/index.ts#L19

Added line #L19 was not covered by tests
export type { PhoneNumberDefinition } from './phone_number';
export type { ScienceDefinition } from './science';
export type { SystemDefinition, SystemMimeTypeEntryDefinition } from './system';
Expand Down
13 changes: 3 additions & 10 deletions src/definitions/person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,11 @@

bio_pattern: string[];

title: PersonTitleDefinition;
job_descriptor: string[];
job_area: string[];
job_type: string[];

Check warning on line 44 in src/definitions/person.ts

View check run for this annotation

Codecov / codecov/patch

src/definitions/person.ts#L42-L44

Added lines #L42 - L44 were not covered by tests

job_title_pattern: string[];

western_zodiac_sign: string[];
}>;

/**
* The possible definitions related to people's titles.
*/
export type PersonTitleDefinition = LocaleEntry<{
descriptor: string[];
job: string[];
level: string[];
}>;
3 changes: 0 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ export type {
/** @deprecated Use PersonDefinitions instead */
PersonDefinition as NameDefinitions,
PersonDefinition,
/** @deprecated Use PersonTitleDefinitions instead */
PersonTitleDefinition as NameTitleDefinitions,
PersonTitleDefinition,
matthewmayer marked this conversation as resolved.
Show resolved Hide resolved
PhoneNumberDefinition,
/** @deprecated Use PhoneNumberDefinition instead */
PhoneNumberDefinition as PhoneNumberDefinitions,
Expand Down
4 changes: 2 additions & 2 deletions src/locales/ar/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ 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_type from './job_type';
import last_name from './last_name';
import last_name_pattern from './last_name_pattern';
import male_first_name from './male_first_name';
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,
female_prefix,
first_name,
job_type,
last_name,
last_name_pattern,
male_first_name,
male_prefix,
name: name_,
prefix,
suffix,
title,
};

export default person;
20 changes: 20 additions & 0 deletions src/locales/ar/person/job_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default [
'مشرف',
'تنفيذي',
'مدير',
'مهندس',
'متخصص',
'رئيس مؤسسة',
'منسق',
'إداري',
'مخطط',
'محلل',
'مصمم',
'تقني',
'مبرمج',
'منتج',
'مستشار',
'مساعد',
'وكيل',
'متدرب',
];
22 changes: 0 additions & 22 deletions src/locales/ar/person/title.ts

This file was deleted.

8 changes: 6 additions & 2 deletions src/locales/el/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,29 @@ 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_area from './job_area';
import job_descriptor from './job_descriptor';
import job_type from './job_type';
import last_name from './last_name';
import last_name_pattern from './last_name_pattern';
import male_first_name from './male_first_name';
import male_prefix from './male_prefix';
import name_ from './name';
import prefix from './prefix';
import title from './title';

const person: PersonDefinition = {
female_first_name,
female_prefix,
first_name,
job_area,
job_descriptor,
job_type,
last_name,
last_name_pattern,
male_first_name,
male_prefix,
name: name_,
prefix,
title,
};

export default person;
32 changes: 32 additions & 0 deletions src/locales/el/person/job_area.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export default [
'Λύσεις',
'Πρόγραμμα',
'Μάρκα',
'Ασφάλεια',
'Έρευνα',
'Μάρκετινγκ',
'Οδηγιών',
'Εφαρμογή',
'Ενσωμάτωση',
'Λειτουργικότητα',
'Τακτική',
'Ταυτότητα',
'Αγορές',
'Όμιλος',
'Εφαρμογές',
'Βελτιστοποίηση',
'Δραστηριότητες',
'Υποδομή',
'Intranet',
'Επικοινωνίες',
'Web',
'Branding',
'Ποιότητα',
'Διασφάλιση',
'Κινητικότητα',
'Λογαριασμοί',
'Δεδομένα',
'Δημιουργική',
'Διαμόρφωση',
'Μετρήσεις',
];
8 changes: 8 additions & 0 deletions src/locales/el/person/job_descriptor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default [
'Senior',
'Εταιρείες',
'Πελάτης',
'Επενδυτής',
'Εσωτερικό',
'Κύριος',
];
19 changes: 19 additions & 0 deletions src/locales/el/person/job_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default [
'Επόπτης',
'Συνεργάτης',
'Σύμβουλος',
'Διευθυντής',
'Μηχανικός',
'Ειδικός',
'Συντονιστή',
'Διαχειριστής',
'Αναλυτής',
'Designer',
'Τεχνικός',
'Προγραμματιστής',
'Παραγωγός',
'Βοηθός',
'Συντονιστής',
'Εκπρόσωπος',
'Αντιπρόσωπος',
];
61 changes: 0 additions & 61 deletions src/locales/el/person/title.ts

This file was deleted.

8 changes: 6 additions & 2 deletions src/locales/en/person/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import female_middle_name from './female_middle_name';
import female_prefix from './female_prefix';
import first_name from './first_name';
import gender from './gender';
import job_area from './job_area';
import job_descriptor from './job_descriptor';
import job_title_pattern from './job_title_pattern';
import job_type from './job_type';
import last_name from './last_name';
import last_name_pattern from './last_name_pattern';
import male_first_name from './male_first_name';
Expand All @@ -22,7 +25,6 @@ import name_ from './name';
import prefix from './prefix';
import sex from './sex';
import suffix from './suffix';
import title from './title';
import western_zodiac_sign from './western_zodiac_sign';

const person: PersonDefinition = {
Expand All @@ -34,7 +36,10 @@ const person: PersonDefinition = {
female_prefix,
first_name,
gender,
job_area,
job_descriptor,
job_title_pattern,
job_type,
last_name,
last_name_pattern,
male_first_name,
Expand All @@ -45,7 +50,6 @@ const person: PersonDefinition = {
prefix,
sex,
suffix,
title,
western_zodiac_sign,
};

Expand Down
39 changes: 39 additions & 0 deletions src/locales/en/person/job_area.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export default [
'Solutions',
'Program',
'Brand',
'Security',
'Research',
'Marketing',
'Directives',
'Implementation',
'Integration',
'Functionality',
'Response',
'Paradigm',
'Tactics',
'Identity',
'Markets',
'Group',
'Division',
'Applications',
'Optimization',
'Operations',
'Infrastructure',
'Intranet',
'Communications',
'Web',
'Branding',
'Quality',
'Assurance',
'Mobility',
'Accounts',
'Data',
'Creative',
'Configuration',
'Accountability',
'Interactions',
'Factors',
'Usability',
'Metrics',
];
23 changes: 23 additions & 0 deletions src/locales/en/person/job_descriptor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default [
'Lead',
'Senior',
'Direct',
'Corporate',
'Dynamic',
'Future',
'Product',
'National',
'Regional',
'District',
'Central',
'Global',
'Customer',
'Investor',
'International',
'Legacy',
'Forward',
'Internal',
'Human',
'Chief',
'Principal',
];
Loading