Person
Module to generate people's personal information such as names and job titles. Prior to Faker 8.0.0, this module was known as faker.name.
Overview
To generate a full name, use fullName. Note that this is not the same as simply concatenating firstName and lastName, as the full name may contain a prefix, suffix, or both. Additionally, different supported locales will have differing name patterns. For example, the last name may appear before the first name, or there may be a double or hyphenated first or last name.
You can also generate the parts of a name separately, using prefix, firstName, middleName, lastName, and suffix. Not all locales support all of these parts.
Many of the methods in this module can optionally choose either female, male or mixed names.
Job-related data is also available. To generate a job title, use jobTitle.
This module can also generate other personal information which might appear in user profiles, such as gender, zodiacSign, and bio.
Related modules
For personal contact information like phone numbers and email addresses, see the faker.phone and faker.internet modules.
bio
Returns a random short biography
Available since v8.0.0
Returns: string
function bio(): string;
Examples
faker.person.bio() // 'oatmeal advocate, veteran 🐠'
Source
firstName
Returns a random first name.
Available since v8.0.0
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| sex? | 'female' | 'male' | The optional sex to use.
Can be either |
Returns: string
function firstName(sex?: SexType): string;
Examples
faker.person.firstName() // 'Antwan'
faker.person.firstName('female') // 'Victoria'
faker.person.firstName('male') // 'Tom'
Source
fullName
Generates a random full name.
Available since v8.0.0
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| options | { ... } | {} | An options object. |
| options.firstName? | string | faker.person.firstName(sex) | The optional first name to use. If not specified a random one will be chosen. |
| options.lastName? | string | faker.person.lastName(sex) | The optional last name to use. If not specified a random one will be chosen. |
| options.sex? | 'female' | 'male' | faker.helpers.arrayElement(['female', 'male']) | The optional sex to use. Can be either |
Returns: string
function fullName(
options: {
firstName?: string;
lastName?: string;
sex?: SexType;
} = {}
): string;
Examples
faker.person.fullName() // 'Allen Brown'
faker.person.fullName({ firstName: 'Joann' }) // 'Joann Osinski'
faker.person.fullName({ firstName: 'Marcella', sex: 'female' }) // 'Mrs. Marcella Huels'
faker.person.fullName({ lastName: 'Beer' }) // 'Mr. Alfonso Beer'
faker.person.fullName({ sex: 'male' }) // 'Fernando Schaefer'
Source
gender
Returns a random gender.
Available since v8.0.0
Returns: string
function gender(): string;
Examples
faker.person.gender() // 'Trans*Man'
Source
jobArea
Generates a random job area.
Available since v8.0.0
Returns: string
function jobArea(): string;
Examples
faker.person.jobArea() // 'Brand'
Source
jobDescriptor
Generates a random job descriptor.
Available since v8.0.0
Returns: string
function jobDescriptor(): string;
Examples
faker.person.jobDescriptor() // 'Customer'
Source
jobTitle
Generates a random job title.
Available since v8.0.0
Returns: string
function jobTitle(): string;
Examples
faker.person.jobTitle() // 'Global Accounts Engineer'
Source
jobType
Generates a random job type.
Available since v8.0.0
Returns: string
function jobType(): string;
Examples
faker.person.jobType() // 'Assistant'
Source
lastName
Returns a random last name.
Available since v8.0.0
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| sex? | 'female' | 'male' | The optional sex to use.
Can be either |
Returns: string
function lastName(sex?: SexType): string;
Examples
faker.person.lastName() // 'Hauck'
faker.person.lastName('female') // 'Grady'
faker.person.lastName('male') // 'Barton'
Source
middleName
Returns a random middle name.
Available since v8.0.0
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| sex? | 'female' | 'male' | The optional sex to use.
Can be either |
Returns: string
function middleName(sex?: SexType): string;
Examples
faker.person.middleName() // 'James'
faker.person.middleName('female') // 'Eloise'
faker.person.middleName('male') // 'Asher'
Source
prefix
Returns a random person prefix.
Available since v8.0.0
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| sex? | 'female' | 'male' | The optional sex to use. Can be either |
Returns: string
function prefix(sex?: SexType): string;
Examples
faker.person.prefix() // 'Miss'
faker.person.prefix('female') // 'Ms.'
faker.person.prefix('male') // 'Mr.'
Source
sex
Returns a random sex.
Output of this method is localised, so it should not be used to fill the parameter sex
available in some other modules for example faker.person.firstName().
Available since v8.0.0
Returns: string
function sex(): string;
Examples
faker.person.sex() // 'female'
See Also
Source
sexType
Returns a random sex type. The SexType is intended to be used in parameters and conditions.
Available since v8.0.0
Returns: 'female' | 'male'
function sexType(): SexType;
Examples
faker.person.sexType() // Sex.Female
See Also
Source
suffix
Returns a random person suffix.
Available since v8.0.0
Returns: string
function suffix(): string;
Examples
faker.person.suffix() // 'DDS'
Source
zodiacSign
Returns a random zodiac sign.
Available since v8.0.0
Returns: string
function zodiacSign(): string;
Examples
faker.person.zodiacSign() // 'Pisces'