From 374db6896be2300ae8ba2fe64acd9301384dca8b Mon Sep 17 00:00:00 2001 From: Peaceful James <66864163+peaceful-james@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:32:42 +0000 Subject: [PATCH] Spec phone number types (#89) --- .../constants/phone_number_types.ex | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/ex_phone_number/constants/phone_number_types.ex b/lib/ex_phone_number/constants/phone_number_types.ex index 0383941..32f3f54 100644 --- a/lib/ex_phone_number/constants/phone_number_types.ex +++ b/lib/ex_phone_number/constants/phone_number_types.ex @@ -1,4 +1,24 @@ defmodule ExPhoneNumber.Constants.PhoneNumberTypes do + @all_types [ + :fixed_line, + :mobile, + :fixed_line_or_mobile, + :toll_free, + :premium_rate, + :shared_cost, + :voip, + :personal_number, + :pager, + :uan, + :voicemail, + :unknown + ] + + @type t :: unquote(Enum.reduce(@all_types, &{:|, [], [&1, &2]})) + + @spec all_types() :: [t()] + def all_types, do: @all_types + def fixed_line(), do: :fixed_line def mobile(), do: :mobile