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
faker.person.bio(): string
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
faker.person.firstName(sex?: 'female' | 'male'): string
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
faker.person.fullName(options: {
firstName: string,
lastName: string,
sex: 'female' | 'male'
} = {}): string
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
faker.person.gender(): string
faker.person.gender() // 'Trans*Man'
Source
jobArea
Generates a random job area.
Available since v8.0.0
Returns: string
faker.person.jobArea(): string
faker.person.jobArea() // 'Brand'
Source
jobDescriptor
Generates a random job descriptor.
Available since v8.0.0
Returns: string
faker.person.jobDescriptor(): string
faker.person.jobDescriptor() // 'Customer'
Source
jobTitle
Generates a random job title.
Available since v8.0.0
Returns: string
faker.person.jobTitle(): string
faker.person.jobTitle() // 'Global Accounts Engineer'
Source
jobType
Generates a random job type.
Available since v8.0.0
Returns: string
faker.person.jobType(): string
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
faker.person.lastName(sex?: 'female' | 'male'): string
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
faker.person.middleName(sex?: 'female' | 'male'): string
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
faker.person.prefix(sex?: 'female' | 'male'): string
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
faker.person.sex(): string
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'
faker.person.sexType(): "female" | "male"
faker.person.sexType() // Sex.Female
See Also
Source
suffix
Returns a random person suffix.
Available since v8.0.0
Returns: string
faker.person.suffix(): string
faker.person.suffix() // 'DDS'
Source
zodiacSign
Returns a random zodiac sign.
Available since v8.0.0
Returns: string
faker.person.zodiacSign(): string
faker.person.zodiacSign() // 'Pisces'