diff --git a/.editorconfig b/.editorconfig
index e98f58d..ea8f4ab 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,18 +1,17 @@
-# EditorConfig: http://EditorConfig.org
+# EditorConfig is awesome: https://EditorConfig.org
-# top-most EditorConfig file
root = true
-# Unix-style newlines with a newline ending every file
[*]
-charset = utf-8
end_of_line = lf
-trim_trailing_whitespace = true
insert_final_newline = true
+
+[*.{js,d.ts,ts}]
+charset = utf-8
+trim_trailing_whitespace = true
indent_style = space
indent_size = 4
-# 2 space indentation
-[*.yaml, *.yml]
+[package.json,*.yaml]
indent_style = space
indent_size = 2
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..94f480d
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+* text=auto eol=lf
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index e7ef1ee..bac2cd5 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# Global
node_modules/
+coverage
# OS Generated
.DS_Store*
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 73f0367..cc45e55 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+
+# [2.1.0](https://github.com/faker-javascript/profession) (2022-01-12)
+* Added xo, tsd, c8.
+* Improved tests.
+
# [2.0.1](https://github.com/faker-javascript/profession) (2022-01-10)
* GitHub docs updates.
diff --git a/index.d.ts b/index.d.ts
new file mode 100644
index 0000000..86435a3
--- /dev/null
+++ b/index.d.ts
@@ -0,0 +1,5 @@
+interface Options {
+ rank?: boolean;
+ locale?: string;
+}
+export default function profession(options?: Options): string;
diff --git a/index.js b/index.js
index f947624..ed6dd78 100644
--- a/index.js
+++ b/index.js
@@ -1,411 +1,412 @@
+/* eslint camelcase: ["error", {properties: "never"}] */
export default function profession(options) {
options = options || {};
- let ranks = {
- "en_US": [
- "Apprentice",
- "Junior",
- "Senior",
- "Lead"
- ]
+ const ranks = {
+ en_US: [
+ 'Apprentice',
+ 'Junior',
+ 'Senior',
+ 'Lead',
+ ],
};
- let professions = {
- "en_US": [
- "Airline Pilot",
- "Academic Team",
- "Accountant",
- "Account Executive",
- "Actor",
- "Actuary",
- "Acquisition Analyst",
- "Administrative Asst.",
- "Administrative Analyst",
- "Administrator",
- "Advertising Director",
- "Aerospace Engineer",
- "Agent",
- "Agricultural Inspector",
- "Agricultural Scientist",
- "Air Traffic Controller",
- "Animal Trainer",
- "Anthropologist",
- "Appraiser",
- "Architect",
- "Art Director",
- "Artist",
- "Astronomer",
- "Athletic Coach",
- "Auditor",
- "Author",
- "Baker",
- "Banker",
- "Bankruptcy Attorney",
- "Benefits Manager",
- "Biologist",
- "Bio-feedback Specialist",
- "Biomedical Engineer",
- "Biotechnical Researcher",
- "Broadcaster",
- "Broker",
- "Building Manager",
- "Building Contractor",
- "Building Inspector",
- "Business Analyst",
- "Business Planner",
- "Business Manager",
- "Buyer",
- "Call Center Manager",
- "Career Counselor",
- "Cash Manager",
- "Ceramic Engineer",
- "Chief Executive Officer",
- "Chief Operation Officer",
- "Chef",
- "Chemical Engineer",
- "Chemist",
- "Child Care Manager",
- "Chief Medical Officer",
- "Chiropractor",
- "Cinematographer",
- "City Housing Manager",
- "City Manager",
- "Civil Engineer",
- "Claims Manager",
- "Clinical Research Assistant",
- "Collections Manager",
- "Compliance Manager",
- "Comptroller",
- "Computer Manager",
- "Commercial Artist",
- "Communications Affairs Director",
- "Communications Director",
- "Communications Engineer",
- "Compensation Analyst",
- "Computer Programmer",
- "Computer Ops. Manager",
- "Computer Engineer",
- "Computer Operator",
- "Computer Graphics Specialist",
- "Construction Engineer",
- "Construction Manager",
- "Consultant",
- "Consumer Relations Manager",
- "Contract Administrator",
- "Copyright Attorney",
- "Copywriter",
- "Corporate Planner",
- "Corrections Officer",
- "Cosmetologist",
- "Credit Analyst",
- "Cruise Director",
- "Chief Information Officer",
- "Chief Technology Officer",
- "Customer Service Manager",
- "Cryptologist",
- "Dancer",
- "Data Security Manager",
- "Database Manager",
- "Day Care Instructor",
- "Dentist",
- "Designer",
- "Design Engineer",
- "Desktop Publisher",
- "Developer",
- "Development Officer",
- "Diamond Merchant",
- "Dietitian",
- "Direct Marketer",
- "Director",
- "Distribution Manager",
- "Diversity Manager",
- "Economist",
- "EEO Compliance Manager",
- "Editor",
- "Education Adminator",
- "Electrical Engineer",
- "Electro Optical Engineer",
- "Electronics Engineer",
- "Embassy Management",
- "Employment Agent",
- "Engineer Technician",
- "Entrepreneur",
- "Environmental Analyst",
- "Environmental Attorney",
- "Environmental Engineer",
- "Environmental Specialist",
- "Escrow Officer",
- "Estimator",
- "Executive Assistant",
- "Executive Director",
- "Executive Recruiter",
- "Facilities Manager",
- "Family Counselor",
- "Fashion Events Manager",
- "Fashion Merchandiser",
- "Fast Food Manager",
- "Film Producer",
- "Film Production Assistant",
- "Financial Analyst",
- "Financial Planner",
- "Financier",
- "Fine Artist",
- "Wildlife Specialist",
- "Fitness Consultant",
- "Flight Attendant",
- "Flight Engineer",
- "Floral Designer",
- "Food & Beverage Director",
- "Food Service Manager",
- "Forestry Technician",
- "Franchise Management",
- "Franchise Sales",
- "Fraud Investigator",
- "Freelance Writer",
- "Fund Raiser",
- "General Manager",
- "Geologist",
- "General Counsel",
- "Geriatric Specialist",
- "Gerontologist",
- "Glamour Photographer",
- "Golf Club Manager",
- "Gourmet Chef",
- "Graphic Designer",
- "Grounds Keeper",
- "Hazardous Waste Manager",
- "Health Care Manager",
- "Health Therapist",
- "Health Service Administrator",
- "Hearing Officer",
- "Home Economist",
- "Horticulturist",
- "Hospital Administrator",
- "Hotel Manager",
- "Human Resources Manager",
- "Importer",
- "Industrial Designer",
- "Industrial Engineer",
- "Information Director",
- "Inside Sales",
- "Insurance Adjuster",
- "Interior Decorator",
- "Internal Controls Director",
- "International Acct.",
- "International Courier",
- "International Lawyer",
- "Interpreter",
- "Investigator",
- "Investment Banker",
- "Investment Manager",
- "IT Architect",
- "IT Project Manager",
- "IT Systems Analyst",
- "Jeweler",
- "Joint Venture Manager",
- "Journalist",
- "Labor Negotiator",
- "Labor Organizer",
- "Labor Relations Manager",
- "Lab Services Director",
- "Lab Technician",
- "Land Developer",
- "Landscape Architect",
- "Law Enforcement Officer",
- "Lawyer",
- "Software Engineer",
- "Software Test Engineer",
- "Leasing Manager",
- "Legal Secretary",
- "Library Manager",
- "Litigation Attorney",
- "Loan Officer",
- "Lobbyist",
- "Logistics Manager",
- "Maintenance Manager",
- "Management Consultant",
- "Managed Care Director",
- "Managing Partner",
- "Manufacturing Director",
- "Manpower Planner",
- "Marine Biologist",
- "Market Res. Analyst",
- "Marketing Director",
- "Materials Manager",
- "Mathematician",
- "Membership Chairman",
- "Mechanic",
- "Mechanical Engineer",
- "Media Buyer",
- "Medical Investor",
- "Medical Secretary",
- "Medical Technician",
- "Mental Health Counselor",
- "Merchandiser",
- "Metallurgical Engineering",
- "Meteorologist",
- "Microbiologist",
- "MIS Manager",
- "Motion Picture Director",
- "Multimedia Director",
- "Musician",
- "Network Administrator",
- "Network Specialist",
- "Network Operator",
- "New Product Manager",
- "Novelist",
- "Nuclear Engineer",
- "Nuclear Specialist",
- "Nutritionist",
- "Nursing Administrator",
- "Occupational Therapist",
- "Oceanographer",
- "Office Manager",
- "Operations Manager",
- "Operations Research Director",
- "Optical Technician",
- "Optometrist",
- "Organizational Development Manager",
- "Outplacement Specialist",
- "Paralegal",
- "Park Ranger",
- "Patent Attorney",
- "Payroll Specialist",
- "Personnel Specialist",
- "Petroleum Engineer",
- "Pharmacist",
- "Photographer",
- "Physical Therapist",
- "Physician",
- "Physician Assistant",
- "Physicist",
- "Planning Director",
- "Podiatrist",
- "Political Analyst",
- "Political Scientist",
- "Politician",
- "Portfolio Manager",
- "Preschool Management",
- "Preschool Teacher",
- "Principal",
- "Private Banker",
- "Private Investigator",
- "Probation Officer",
- "Process Engineer",
- "Producer",
- "Product Manager",
- "Product Engineer",
- "Production Engineer",
- "Production Planner",
- "Professional Athlete",
- "Professional Coach",
- "Professor",
- "Project Engineer",
- "Project Manager",
- "Program Manager",
- "Property Manager",
- "Public Administrator",
- "Public Safety Director",
- "PR Specialist",
- "Publisher",
- "Purchasing Agent",
- "Publishing Director",
- "Quality Assurance Specialist",
- "Quality Control Engineer",
- "Quality Control Inspector",
- "Radiology Manager",
- "Railroad Engineer",
- "Real Estate Broker",
- "Recreational Director",
- "Recruiter",
- "Redevelopment Specialist",
- "Regulatory Affairs Manager",
- "Registered Nurse",
- "Rehabilitation Counselor",
- "Relocation Manager",
- "Reporter",
- "Research Specialist",
- "Restaurant Manager",
- "Retail Store Manager",
- "Risk Analyst",
- "Safety Engineer",
- "Sales Engineer",
- "Sales Trainer",
- "Sales Promotion Manager",
- "Sales Representative",
- "Sales Manager",
- "Service Manager",
- "Sanitation Engineer",
- "Scientific Programmer",
- "Scientific Writer",
- "Securities Analyst",
- "Security Consultant",
- "Security Director",
- "Seminar Presenter",
- "Ship's Officer",
- "Singer",
- "Social Director",
- "Social Program Planner",
- "Social Research",
- "Social Scientist",
- "Social Worker",
- "Sociologist",
- "Software Developer",
- "Software Engineer",
- "Software Test Engineer",
- "Soil Scientist",
- "Special Events Manager",
- "Special Education Teacher",
- "Special Projects Director",
- "Speech Pathologist",
- "Speech Writer",
- "Sports Event Manager",
- "Statistician",
- "Store Manager",
- "Strategic Alliance Director",
- "Strategic Planning Director",
- "Stress Reduction Specialist",
- "Stockbroker",
- "Surveyor",
- "Structural Engineer",
- "Superintendent",
- "Supply Chain Director",
- "System Engineer",
- "Systems Analyst",
- "Systems Programmer",
- "System Administrator",
- "Tax Specialist",
- "Teacher",
- "Technical Support Specialist",
- "Technical Illustrator",
- "Technical Writer",
- "Technology Director",
- "Telecom Analyst",
- "Telemarketer",
- "Theatrical Director",
- "Title Examiner",
- "Tour Escort",
- "Tour Guide Director",
- "Traffic Manager",
- "Trainer Translator",
- "Transportation Manager",
- "Travel Agent",
- "Treasurer",
- "TV Programmer",
- "Underwriter",
- "Union Representative",
- "University Administrator",
- "University Dean",
- "Urban Planner",
- "Veterinarian",
- "Vendor Relations Director",
- "Viticulturist",
- "Warehouse Manager"
- ]
+ const professions = {
+ en_US: [
+ 'Airline Pilot',
+ 'Academic Team',
+ 'Accountant',
+ 'Account Executive',
+ 'Actor',
+ 'Actuary',
+ 'Acquisition Analyst',
+ 'Administrative Asst.',
+ 'Administrative Analyst',
+ 'Administrator',
+ 'Advertising Director',
+ 'Aerospace Engineer',
+ 'Agent',
+ 'Agricultural Inspector',
+ 'Agricultural Scientist',
+ 'Air Traffic Controller',
+ 'Animal Trainer',
+ 'Anthropologist',
+ 'Appraiser',
+ 'Architect',
+ 'Art Director',
+ 'Artist',
+ 'Astronomer',
+ 'Athletic Coach',
+ 'Auditor',
+ 'Author',
+ 'Baker',
+ 'Banker',
+ 'Bankruptcy Attorney',
+ 'Benefits Manager',
+ 'Biologist',
+ 'Bio-feedback Specialist',
+ 'Biomedical Engineer',
+ 'Biotechnical Researcher',
+ 'Broadcaster',
+ 'Broker',
+ 'Building Manager',
+ 'Building Contractor',
+ 'Building Inspector',
+ 'Business Analyst',
+ 'Business Planner',
+ 'Business Manager',
+ 'Buyer',
+ 'Call Center Manager',
+ 'Career Counselor',
+ 'Cash Manager',
+ 'Ceramic Engineer',
+ 'Chief Executive Officer',
+ 'Chief Operation Officer',
+ 'Chef',
+ 'Chemical Engineer',
+ 'Chemist',
+ 'Child Care Manager',
+ 'Chief Medical Officer',
+ 'Chiropractor',
+ 'Cinematographer',
+ 'City Housing Manager',
+ 'City Manager',
+ 'Civil Engineer',
+ 'Claims Manager',
+ 'Clinical Research Assistant',
+ 'Collections Manager',
+ 'Compliance Manager',
+ 'Comptroller',
+ 'Computer Manager',
+ 'Commercial Artist',
+ 'Communications Affairs Director',
+ 'Communications Director',
+ 'Communications Engineer',
+ 'Compensation Analyst',
+ 'Computer Programmer',
+ 'Computer Ops. Manager',
+ 'Computer Engineer',
+ 'Computer Operator',
+ 'Computer Graphics Specialist',
+ 'Construction Engineer',
+ 'Construction Manager',
+ 'Consultant',
+ 'Consumer Relations Manager',
+ 'Contract Administrator',
+ 'Copyright Attorney',
+ 'Copywriter',
+ 'Corporate Planner',
+ 'Corrections Officer',
+ 'Cosmetologist',
+ 'Credit Analyst',
+ 'Cruise Director',
+ 'Chief Information Officer',
+ 'Chief Technology Officer',
+ 'Customer Service Manager',
+ 'Cryptologist',
+ 'Dancer',
+ 'Data Security Manager',
+ 'Database Manager',
+ 'Day Care Instructor',
+ 'Dentist',
+ 'Designer',
+ 'Design Engineer',
+ 'Desktop Publisher',
+ 'Developer',
+ 'Development Officer',
+ 'Diamond Merchant',
+ 'Dietitian',
+ 'Direct Marketer',
+ 'Director',
+ 'Distribution Manager',
+ 'Diversity Manager',
+ 'Economist',
+ 'EEO Compliance Manager',
+ 'Editor',
+ 'Education Adminator',
+ 'Electrical Engineer',
+ 'Electro Optical Engineer',
+ 'Electronics Engineer',
+ 'Embassy Management',
+ 'Employment Agent',
+ 'Engineer Technician',
+ 'Entrepreneur',
+ 'Environmental Analyst',
+ 'Environmental Attorney',
+ 'Environmental Engineer',
+ 'Environmental Specialist',
+ 'Escrow Officer',
+ 'Estimator',
+ 'Executive Assistant',
+ 'Executive Director',
+ 'Executive Recruiter',
+ 'Facilities Manager',
+ 'Family Counselor',
+ 'Fashion Events Manager',
+ 'Fashion Merchandiser',
+ 'Fast Food Manager',
+ 'Film Producer',
+ 'Film Production Assistant',
+ 'Financial Analyst',
+ 'Financial Planner',
+ 'Financier',
+ 'Fine Artist',
+ 'Wildlife Specialist',
+ 'Fitness Consultant',
+ 'Flight Attendant',
+ 'Flight Engineer',
+ 'Floral Designer',
+ 'Food & Beverage Director',
+ 'Food Service Manager',
+ 'Forestry Technician',
+ 'Franchise Management',
+ 'Franchise Sales',
+ 'Fraud Investigator',
+ 'Freelance Writer',
+ 'Fund Raiser',
+ 'General Manager',
+ 'Geologist',
+ 'General Counsel',
+ 'Geriatric Specialist',
+ 'Gerontologist',
+ 'Glamour Photographer',
+ 'Golf Club Manager',
+ 'Gourmet Chef',
+ 'Graphic Designer',
+ 'Grounds Keeper',
+ 'Hazardous Waste Manager',
+ 'Health Care Manager',
+ 'Health Therapist',
+ 'Health Service Administrator',
+ 'Hearing Officer',
+ 'Home Economist',
+ 'Horticulturist',
+ 'Hospital Administrator',
+ 'Hotel Manager',
+ 'Human Resources Manager',
+ 'Importer',
+ 'Industrial Designer',
+ 'Industrial Engineer',
+ 'Information Director',
+ 'Inside Sales',
+ 'Insurance Adjuster',
+ 'Interior Decorator',
+ 'Internal Controls Director',
+ 'International Acct.',
+ 'International Courier',
+ 'International Lawyer',
+ 'Interpreter',
+ 'Investigator',
+ 'Investment Banker',
+ 'Investment Manager',
+ 'IT Architect',
+ 'IT Project Manager',
+ 'IT Systems Analyst',
+ 'Jeweler',
+ 'Joint Venture Manager',
+ 'Journalist',
+ 'Labor Negotiator',
+ 'Labor Organizer',
+ 'Labor Relations Manager',
+ 'Lab Services Director',
+ 'Lab Technician',
+ 'Land Developer',
+ 'Landscape Architect',
+ 'Law Enforcement Officer',
+ 'Lawyer',
+ 'Software Engineer',
+ 'Software Test Engineer',
+ 'Leasing Manager',
+ 'Legal Secretary',
+ 'Library Manager',
+ 'Litigation Attorney',
+ 'Loan Officer',
+ 'Lobbyist',
+ 'Logistics Manager',
+ 'Maintenance Manager',
+ 'Management Consultant',
+ 'Managed Care Director',
+ 'Managing Partner',
+ 'Manufacturing Director',
+ 'Manpower Planner',
+ 'Marine Biologist',
+ 'Market Res. Analyst',
+ 'Marketing Director',
+ 'Materials Manager',
+ 'Mathematician',
+ 'Membership Chairman',
+ 'Mechanic',
+ 'Mechanical Engineer',
+ 'Media Buyer',
+ 'Medical Investor',
+ 'Medical Secretary',
+ 'Medical Technician',
+ 'Mental Health Counselor',
+ 'Merchandiser',
+ 'Metallurgical Engineering',
+ 'Meteorologist',
+ 'Microbiologist',
+ 'MIS Manager',
+ 'Motion Picture Director',
+ 'Multimedia Director',
+ 'Musician',
+ 'Network Administrator',
+ 'Network Specialist',
+ 'Network Operator',
+ 'New Product Manager',
+ 'Novelist',
+ 'Nuclear Engineer',
+ 'Nuclear Specialist',
+ 'Nutritionist',
+ 'Nursing Administrator',
+ 'Occupational Therapist',
+ 'Oceanographer',
+ 'Office Manager',
+ 'Operations Manager',
+ 'Operations Research Director',
+ 'Optical Technician',
+ 'Optometrist',
+ 'Organizational Development Manager',
+ 'Outplacement Specialist',
+ 'Paralegal',
+ 'Park Ranger',
+ 'Patent Attorney',
+ 'Payroll Specialist',
+ 'Personnel Specialist',
+ 'Petroleum Engineer',
+ 'Pharmacist',
+ 'Photographer',
+ 'Physical Therapist',
+ 'Physician',
+ 'Physician Assistant',
+ 'Physicist',
+ 'Planning Director',
+ 'Podiatrist',
+ 'Political Analyst',
+ 'Political Scientist',
+ 'Politician',
+ 'Portfolio Manager',
+ 'Preschool Management',
+ 'Preschool Teacher',
+ 'Principal',
+ 'Private Banker',
+ 'Private Investigator',
+ 'Probation Officer',
+ 'Process Engineer',
+ 'Producer',
+ 'Product Manager',
+ 'Product Engineer',
+ 'Production Engineer',
+ 'Production Planner',
+ 'Professional Athlete',
+ 'Professional Coach',
+ 'Professor',
+ 'Project Engineer',
+ 'Project Manager',
+ 'Program Manager',
+ 'Property Manager',
+ 'Public Administrator',
+ 'Public Safety Director',
+ 'PR Specialist',
+ 'Publisher',
+ 'Purchasing Agent',
+ 'Publishing Director',
+ 'Quality Assurance Specialist',
+ 'Quality Control Engineer',
+ 'Quality Control Inspector',
+ 'Radiology Manager',
+ 'Railroad Engineer',
+ 'Real Estate Broker',
+ 'Recreational Director',
+ 'Recruiter',
+ 'Redevelopment Specialist',
+ 'Regulatory Affairs Manager',
+ 'Registered Nurse',
+ 'Rehabilitation Counselor',
+ 'Relocation Manager',
+ 'Reporter',
+ 'Research Specialist',
+ 'Restaurant Manager',
+ 'Retail Store Manager',
+ 'Risk Analyst',
+ 'Safety Engineer',
+ 'Sales Engineer',
+ 'Sales Trainer',
+ 'Sales Promotion Manager',
+ 'Sales Representative',
+ 'Sales Manager',
+ 'Service Manager',
+ 'Sanitation Engineer',
+ 'Scientific Programmer',
+ 'Scientific Writer',
+ 'Securities Analyst',
+ 'Security Consultant',
+ 'Security Director',
+ 'Seminar Presenter',
+ 'Ship\'s Officer',
+ 'Singer',
+ 'Social Director',
+ 'Social Program Planner',
+ 'Social Research',
+ 'Social Scientist',
+ 'Social Worker',
+ 'Sociologist',
+ 'Software Developer',
+ 'Software Engineer',
+ 'Software Test Engineer',
+ 'Soil Scientist',
+ 'Special Events Manager',
+ 'Special Education Teacher',
+ 'Special Projects Director',
+ 'Speech Pathologist',
+ 'Speech Writer',
+ 'Sports Event Manager',
+ 'Statistician',
+ 'Store Manager',
+ 'Strategic Alliance Director',
+ 'Strategic Planning Director',
+ 'Stress Reduction Specialist',
+ 'Stockbroker',
+ 'Surveyor',
+ 'Structural Engineer',
+ 'Superintendent',
+ 'Supply Chain Director',
+ 'System Engineer',
+ 'Systems Analyst',
+ 'Systems Programmer',
+ 'System Administrator',
+ 'Tax Specialist',
+ 'Teacher',
+ 'Technical Support Specialist',
+ 'Technical Illustrator',
+ 'Technical Writer',
+ 'Technology Director',
+ 'Telecom Analyst',
+ 'Telemarketer',
+ 'Theatrical Director',
+ 'Title Examiner',
+ 'Tour Escort',
+ 'Tour Guide Director',
+ 'Traffic Manager',
+ 'Trainer Translator',
+ 'Transportation Manager',
+ 'Travel Agent',
+ 'Treasurer',
+ 'TV Programmer',
+ 'Underwriter',
+ 'Union Representative',
+ 'University Administrator',
+ 'University Dean',
+ 'Urban Planner',
+ 'Veterinarian',
+ 'Vendor Relations Director',
+ 'Viticulturist',
+ 'Warehouse Manager',
+ ],
};
- let locale = options.locale || 'en_US';
- let randomProfession = professions[locale][Math.floor(Math.random() * professions[locale].length)];
+ const locale = options.locale || 'en_US';
+ const randomProfession = professions[locale][Math.floor(Math.random() * professions[locale].length)];
if (options.rank) {
return ranks[locale][Math.floor(Math.random() * ranks[locale].length)] + ' ' + randomProfession;
- } else {
- return randomProfession;
}
-};
\ No newline at end of file
+
+ return randomProfession;
+}
diff --git a/index.test-d.ts b/index.test-d.ts
new file mode 100644
index 0000000..af61f23
--- /dev/null
+++ b/index.test-d.ts
@@ -0,0 +1,6 @@
+import {expectType} from 'tsd';
+import profession from './index.js';
+
+expectType(profession());
+expectType(profession({rank: true}));
+expectType(profession({rank: true, locale: 'en_US'}));
\ No newline at end of file
diff --git a/package.json b/package.json
index 62362e3..a5d002f 100644
--- a/package.json
+++ b/package.json
@@ -15,13 +15,17 @@
"node": ">=12"
},
"scripts": {
- "test": "ava"
+ "test": "c8 ava; xo --space 4; tsd;"
},
"devDependencies": {
- "ava": "^3.15.0"
+ "ava": "^4.0.0",
+ "c8": "^7.11.0",
+ "tsd": "^0.19.1",
+ "xo": "^0.47.0"
},
"files": [
- "index.js"
+ "index.js",
+ "index.d.ts"
],
"keywords": [
"fakerjs",
diff --git a/test.js b/test.js
index 29845b2..04028a9 100644
--- a/test.js
+++ b/test.js
@@ -1,10 +1,14 @@
-import profession from './index.js';
import test from 'ava';
+import profession from './index.js';
test('profession return type to be string', t => {
- t.is(typeof profession(), 'string');
+ t.is(typeof profession(), 'string');
});
test('profession with rank return type to be string', t => {
- t.is(typeof profession({rank: true}), 'string');
-});
\ No newline at end of file
+ t.is(typeof profession({rank: true}), 'string');
+});
+
+test('profession with rank and locale en_US return type to be string', t => {
+ t.is(typeof profession({rank: true, locale: 'en_US'}), 'string');
+});