Phone
Module to generate phone-related data.
imei
Generates IMEI number.
Available since v6.2.0
Returns: string
ts
faker.phone.imei(): string
faker.phone.imei() // => "55-786858-466342-8"
faker.phone.imei() // '13-850175-913761-7'
number
Generates a random phone number.
Available since v7.3.0
Parameters
Name | Type | Default | Description |
---|---|---|---|
format? | string | Format of the phone number. Defaults to a random phone number format. |
Returns: string
ts
faker.phone.number(format?: string): string
faker.phone.number() // => "678-685-8466 x3428"
faker.phone.number() // '961-770-7727'
faker.phone.number('501-###-###') // '501-039-841'
faker.phone.number('+48 91 ### ## ##') // '+48 91 463 61 70'
phoneFormats
Deprecated
This method is deprecated and will be removed in a future version.
Returns a random phone number format.
Available since v2.0.1
Returns: string
ts
faker.phone.phoneFormats(): string
faker.phone.phoneFormats() // => "!##-!##-#### x####"
faker.phone.phoneFormats() // '!##.!##.####'
phoneNumber
Deprecated
This method is deprecated and will be removed in a future version.
Generates a random phone number.
Available since v2.0.1
Parameters
Name | Type | Default | Description |
---|---|---|---|
format? | string | Format of the phone number. Defaults to a random phone number format. |
Returns: string
ts
faker.phone.phoneNumber(format?: string): string
faker.phone.phoneNumber() // => "678-685-8466 x3428"
faker.phone.phoneNumber() // '961-770-7727'
faker.phone.phoneNumber('501-###-###') // '501-039-841'
faker.phone.phoneNumber('+48 91 ### ## ##') // '+48 91 463 61 70'
See Also
phoneNumberFormat
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
.
Available since v2.0.1
Parameters
Name | Type | Default | Description |
---|---|---|---|
phoneFormatsArrayIndex | number | 0 | Index in the |
Returns: string
ts
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'