Skip to content
On this page

Name

Module to generate people's names and titles.

findName

Deprecated

This method is deprecated and will be removed in a future version.

Generates a random full name.

Available since v2.0.1

Parameters

NameTypeDefaultDescription
firstName?string

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

lastName?string

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

sex?'female' | 'male'

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

Returns: string

ts
faker.name.findName(firstName?: string, lastName?: string, sex?: 'female' | 'male'): string
faker.name.findName() // => "Terrence Rau"
faker.name.findName() // 'Allen Brown'
faker.name.findName('Joann') // 'Joann Osinski'
faker.name.findName('Marcella', '', 'female') // 'Mrs. Marcella Huels'
faker.name.findName(undefined, 'Beer') // 'Mr. Alfonso Beer'
faker.name.findName(undefined, undefined, 'male') // 'Fernando Schaefer'

firstName

Returns a random first name.

Available since v2.0.1

Parameters

NameTypeDefaultDescription
sex?'female' | 'male'

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

Returns: string

ts
faker.name.firstName(sex?: 'female' | 'male'): string
faker.name.firstName() // => "Katharina"
faker.name.firstName() // 'Antwan'
faker.name.firstName('female') // 'Victoria'
faker.name.firstName('male') // 'Tom'

fullName

Generates a random full name.

Available since v7.4.0

Parameters

NameTypeDefaultDescription
options{ ... }{}

An options object.

options.firstName?string

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

options.gender?'female' | 'male'

Deprecated. Use sex instead.

options.lastName?string

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

options.sex?'female' | 'male'

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

Returns: string

ts
faker.name.fullName(options: {
  firstName: string,
  gender: 'female' | 'male',
  lastName: string,
  sex: 'female' | 'male'
} = {}): string
faker.name.fullName() // => "Terrence Rau"
faker.name.fullName() // 'Allen Brown'
faker.name.fullName({ firstName: 'Joann' }) // 'Joann Osinski'
faker.name.fullName({ firstName: 'Marcella', sex: 'female' }) // 'Mrs. Marcella Huels'
faker.name.fullName({ lastName: 'Beer' }) // 'Mr. Alfonso Beer'
faker.name.fullName({ sex: 'male' }) // 'Fernando Schaefer'

gender

Returns a random gender.

Available since v5.0.0

Parameters

NameTypeDefaultDescription
binary?booleanfalse

(deprecated) Whether to return only binary gender names.

Returns: string

ts
faker.name.gender(binary?: boolean = false): string
faker.name.gender() // => "Male to female transgender woman"
faker.name.gender() // 'Trans*Man'

jobArea

Generates a random job area.

Available since v3.0.0

Returns: string

ts
faker.name.jobArea(): string
faker.name.jobArea() // => "Infrastructure"
faker.name.jobArea() // 'Brand'

jobDescriptor

Generates a random job descriptor.

Available since v3.0.0

Returns: string

ts
faker.name.jobDescriptor(): string
faker.name.jobDescriptor() // => "Global"
faker.name.jobDescriptor() // 'Customer'

jobTitle

Generates a random job title.

Available since v3.0.0

Returns: string

ts
faker.name.jobTitle(): string
faker.name.jobTitle() // => "Global Intranet Developer"
faker.name.jobTitle() // 'Global Accounts Engineer'

jobType

Generates a random job type.

Available since v3.0.0

Returns: string

ts
faker.name.jobType(): string
faker.name.jobType() // => "Designer"
faker.name.jobType() // 'Assistant'

lastName

Returns a random last name.

Available since v2.0.1

Parameters

NameTypeDefaultDescription
sex?'female' | 'male'

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

Returns: string

ts
faker.name.lastName(sex?: 'female' | 'male'): string
faker.name.lastName() // => "Lowe"
faker.name.lastName() // 'Hauck'
faker.name.lastName('female') // 'Grady'
faker.name.lastName('male') // 'Barton'

middleName

Returns a random middle name.

Available since v5.2.0

Parameters

NameTypeDefaultDescription
sex?'female' | 'male'

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

Returns: string

ts
faker.name.middleName(sex?: 'female' | 'male'): string
faker.name.middleName() // => "Kyle"
faker.name.middleName() // 'James'
faker.name.middleName('female') // 'Eloise'
faker.name.middleName('male') // 'Asher'

prefix

Returns a random name prefix.

Available since v2.0.1

Parameters

NameTypeDefaultDescription
sex?'female' | 'male'

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

Returns: string

ts
faker.name.prefix(sex?: 'female' | 'male'): string
faker.name.prefix() // => "Ms."
faker.name.prefix() // 'Miss'
faker.name.prefix('female') // 'Ms.'
faker.name.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.name.firstName().

Available since v7.5.0

Returns: string

ts
faker.name.sex(): string
faker.name.sex() // => "male"
faker.name.sex() // 'female'

sexType

Returns a random sex type.

Available since v7.5.0

Returns: 'female' | 'male'

ts
faker.name.sexType(): "female" | "male"
faker.name.sexType() // => "male"
faker.name.sexType() // Sex.Female

suffix

Returns a random name suffix.

Available since v2.0.1

Returns: string

ts
faker.name.suffix(): string
faker.name.suffix() // => "V"
faker.name.suffix() // 'DDS'

Released under the MIT License.