Phone

Module to generate phone-related data.

Imei

Generates IMEI number.

Returns: string

faker.phone.imei(): string
faker.phone.imei() // => "55-786858-466342-8"
faker.phone.imei() // '13-850175-913761-7'

Phone Formats

Deprecated

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

Returns a random phone number format.

Returns: string

faker.phone.phoneFormats(): string
faker.phone.phoneFormats() // => "1-!##-!##-#### x###"
faker.phone.phoneFormats() // '!##.!##.####'

Phone Number

Generates a random phone number.

Parameters

NameTypeDefaultDescription
format?string

Format of the phone number. Defaults to a random phone number format.

Returns: string

faker.phone.phoneNumber(format?: string): string
faker.phone.phoneNumber() // => "1-678-685-8466 x342"
faker.phone.phoneNumber() // '961-770-7727'
faker.phone.phoneNumber('501-###-###') // '501-039-841'
faker.phone.phoneNumber('+48 91 ### ## ##') // '+48 91 463 61 70'

Phone Number Format

Deprecated

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

Returns phone number in a format of the given index from faker.definitions.phone_number.formats.

Parameters

NameTypeDefaultDescription
phoneFormatsArrayIndexnumber0

Index in the faker.definitions.phone_number.formats array.

Returns: string

faker.phone.phoneNumberFormat(phoneFormatsArrayIndex: number = 0): string
faker.phone.phoneNumberFormat() // => "657-868-5846"
faker.phone.phoneNumberFormat() // '943-627-0355'
faker.phone.phoneNumberFormat(3) // '282.652.3201'