Skip to content

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.

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

ts
faker.person.bio(): string
faker.person.bio() // 'oatmeal advocate, veteran 🐠'

firstName

Returns a random first name.

Available since v8.0.0

Parameters

NameTypeDefaultDescription
sex?'female' | 'male'

The optional sex to use. Can be either 'female' or 'male'.

Returns: string

ts
faker.person.firstName(sex?: 'female' | 'male'): string
faker.person.firstName() // 'Antwan'
faker.person.firstName('female') // 'Victoria'
faker.person.firstName('male') // 'Tom'

fullName

Generates a random full name.

Available since v8.0.0

Parameters

NameTypeDefaultDescription
options{ ... }{}

An options object.

options.firstName?stringfaker.person.firstName(sex)

The optional first name to use. If not specified a random one will be chosen.

options.lastName?stringfaker.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 'female' or 'male'.

Returns: string

ts
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'

gender

Returns a random gender.

Available since v8.0.0

Returns: string

ts
faker.person.gender(): string
faker.person.gender() // 'Trans*Man'

jobArea

Generates a random job area.

Available since v8.0.0

Returns: string

ts
faker.person.jobArea(): string
faker.person.jobArea() // 'Brand'

jobDescriptor

Generates a random job descriptor.

Available since v8.0.0

Returns: string

ts
faker.person.jobDescriptor(): string
faker.person.jobDescriptor() // 'Customer'

jobTitle

Generates a random job title.

Available since v8.0.0

Returns: string

ts
faker.person.jobTitle(): string
faker.person.jobTitle() // 'Global Accounts Engineer'

jobType

Generates a random job type.

Available since v8.0.0

Returns: string

ts
faker.person.jobType(): string
faker.person.jobType() // 'Assistant'

lastName

Returns a random last name.

Available since v8.0.0

Parameters

NameTypeDefaultDescription
sex?'female' | 'male'

The optional sex to use. Can be either 'female' or 'male'.

Returns: string

ts
faker.person.lastName(sex?: 'female' | 'male'): string
faker.person.lastName() // 'Hauck'
faker.person.lastName('female') // 'Grady'
faker.person.lastName('male') // 'Barton'

middleName

Returns a random middle name.

Available since v8.0.0

Parameters

NameTypeDefaultDescription
sex?'female' | 'male'

The optional sex to use. Can be either 'female' or 'male'.

Returns: string

ts
faker.person.middleName(sex?: 'female' | 'male'): string
faker.person.middleName() // 'James'
faker.person.middleName('female') // 'Eloise'
faker.person.middleName('male') // 'Asher'

prefix

Returns a random person prefix.

Available since v8.0.0

Parameters

NameTypeDefaultDescription
sex?'female' | 'male'

The optional sex to use. Can be either 'female' or 'male'.

Returns: string

ts
faker.person.prefix(sex?: 'female' | 'male'): string
faker.person.prefix() // 'Miss'
faker.person.prefix('female') // 'Ms.'
faker.person.prefix('male') // 'Mr.'

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

ts
faker.person.sex(): string
faker.person.sex() // 'female'

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'

ts
faker.person.sexType(): "female" | "male"
faker.person.sexType() // Sex.Female

suffix

Returns a random person suffix.

Available since v8.0.0

Returns: string

ts
faker.person.suffix(): string
faker.person.suffix() // 'DDS'

zodiacSign

Returns a random zodiac sign.

Available since v8.0.0

Returns: string

ts
faker.person.zodiacSign(): string
faker.person.zodiacSign() // 'Pisces'

Released under the MIT License.