Skip to content

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.

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 Ratke"
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.

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() // => "Katelynn"
faker.name.firstName() // 'Antwan'
faker.name.firstName('female') // 'Victoria'
faker.name.firstName('male') // 'Tom'

fullName

Generates a random full name.

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 Ratke"
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

Return a random gender.

Parameters

NameTypeDefaultDescription
binary?booleanfalse

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'
faker.name.gender(true) // 'Female'

jobArea

Generates a random job area.

Returns: string

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

jobDescriptor

Generates a random job descriptor.

Returns: string

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

jobTitle

Generates a random job title.

Returns: string

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

jobType

Generates a random job type.

Returns: string

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

lastName

Returns a random last name.

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.

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.

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

suffix

Returns a random name suffix.

Returns: string

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

Released under the MIT License.