Skip to content

Phone

Module to generate phone-related data.

Overview

For a phone number, use number(). Many locales provide country-specific formats.

imei

Generates IMEI number.

Available since v6.2.0

Returns: string

ts
function imei(): string;

Examples

ts
faker.phone.imei() // '13-850175-913761-7'

number

Generates a random phone number.

Available since v7.3.0

Parameters

NameTypeDefaultDescription
options{ ... }{}

Options object

options.style?'human' | 'national' | 'international''human'

Style of the generated phone number:

  • 'human': (default) A human-input phone number, e.g. 555-770-7727 or 555.770.7727 x1234
  • 'national': A phone number in a standardized national format, e.g. (555) 123-4567.
  • 'international': A phone number in the E.123 international format, e.g. +15551234567

Returns: string

ts
function number(
  options: {
    style?: 'human' | 'national' | 'international';
  } = {}
): string;

Examples

ts
faker.phone.number() // '961-770-7727'
faker.phone.number({ style: 'human' }) // '555.770.7727 x1234'
faker.phone.number({ style: 'national' }) // '(961) 770-7727'
faker.phone.number({ style: 'international' }) // '+15551234567'

Released under the MIT License.