Skip to content

marinakr/libphonenumber_elixir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Libphonenumber

Hex.pm

Elixir partial version of libphonenumber by Google. Usage:

Check is phone number (MSISDN)

iex> Libphonenumber.mobile_phone_valid?("+380938562241")
true

iex> Libphonenumber.mobile_phone_valid?("+380338560241")
false

Get phone number info (MSISDN)

iex> Libphonenumber.mobile_phone_number_info("+380938562241")
%{
  country_metadata: %{code: "380", id: "UA", name: "Ukraine (UA)"},
  errors: [],
  phone: "+380938562241",
  valid: true
}

iex> Libphonenumber.mobile_phone_number_info("+380238562241")
%{
  errors: [
    %{'NO PAIRS' => 'Finished'},
    %{"3" => "No country code info found"},
    %{"38" => "No country code info found"},
    %{"380" => "Pattern '(?:50|6[36-8]|7[1-3]|9[1-9])\\d{7}' compilation failed"}
    ],
    valid: false
    }

Installation

The package can be installed by adding libphonenumber to your list of dependencies in mix.exs:

def deps do
  [
    {:libphonenumber, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. The docs can be found at https://hexdocs.pm/libphonenumber.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages