Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation #78

Merged
merged 5 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 ExPhoneNumber
Copyright (c) 2023-2024 ExPhoneNumber

Copyright (c) 2016-2022 NLCollect B.V.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ There is a `mix update_metadata` task that downloads the latest `libphonenumber`

## Copyright and License

Copyright (c) 2023 ExPhoneNumber
Copyright (c) 2023-2024 ExPhoneNumber

Copyright (c) 2016-2022 NLCollect B.V.

Expand Down
31 changes: 30 additions & 1 deletion lib/ex_phone_number.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
defmodule ExPhoneNumber do
@moduledoc false
@moduledoc """
Parsing, formatting, and validating international phone numbers.

## Example Usage

iex> ExPhoneNumber.parse("202-456-1111", "US")
{
:ok,
%ExPhoneNumber.Model.PhoneNumber{
country_code: 1,
country_code_source: nil,
extension: nil,
italian_leading_zero: nil,
national_number: 2024561111,
number_of_leading_zeros: nil,
preferred_domestic_carrier_code: nil,
raw_input: nil
}
}

iex> {:ok, phone_number} = ExPhoneNumber.parse("202-456-1111", "US")
iex> ExPhoneNumber.format(phone_number, :e164)
"+12024561111"
iex> ExPhoneNumber.is_valid_number?(phone_number)
true
iex> ExPhoneNumber.is_possible_number?(phone_number)
true
iex> ExPhoneNumber.get_number_type(phone_number)
:fixed_line_or_mobile
"""

alias ExPhoneNumber.Formatting
alias ExPhoneNumber.Parsing
Expand Down
5 changes: 3 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ defmodule ExPhoneNumber.Mixfile do

defp docs do
[
extras: ["README.md"],
extras: ["README.md", "LICENSE.md", "CHANGELOG.md"],
main: "readme",
source_url: @source_url,
source_ref: "v#{@version}",
homepage_url: @source_url
homepage_url: @source_url,
skip_undefined_reference_warnings_on: ["CHANGELOG.md"]
]
end
end
5 changes: 5 additions & 0 deletions test/ex_phone_number_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule ExPhoneNumberTest do
use ExSpec, async: true

doctest ExPhoneNumber
end
Loading