Skip to content

Commit

Permalink
Expose new function in root module
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceful-james committed Nov 26, 2024
1 parent 8a41dee commit 83ba239
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ex_phone_number.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ defmodule ExPhoneNumber do
alias ExPhoneNumber.Formatting
alias ExPhoneNumber.Parsing
alias ExPhoneNumber.Validation
alias ExPhoneNumber.Metadata

def format(%ExPhoneNumber.Model.PhoneNumber{} = phone_number, phone_number_format)
when is_atom(phone_number_format),
Expand All @@ -52,4 +53,9 @@ defmodule ExPhoneNumber do

def parse(number_to_parse, default_region),
do: Parsing.parse(number_to_parse, default_region)

@doc """
Returns a map of country codes to region codes.
"""
defdelegate country_code_to_region_code_map(), to: Metadata
end
1 change: 1 addition & 0 deletions lib/ex_phone_number/metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ defmodule ExPhoneNumber.Metadata do
Map.put(acc, new_key, Keyword.get_values(list_cctrc, key))
end)

@doc false
def country_code_to_region_code_map() do
unquote(Macro.escape(map_cctrc))
end
Expand Down

0 comments on commit 83ba239

Please sign in to comment.