Registry of country calling codes following ITU-T E.164 standard.

This module provides a comprehensive mapping of international dialing codes to their respective countries and validation rules.

Constructors

Methods

  • Gets the country calling code information from a phone number. Tries to match from longest to shortest code to handle overlapping prefixes.

    Parameters

    • phoneNumber: string

      The phone number starting with +

    Returns undefined | CountryCallingCodeInfo

    The country code info or undefined if not found

    const info = CountryCallingCodeRegistry.findCode('+1234567890');
    console.log(info?.country); // "United States / Canada"