GithubHelp home page GithubHelp logo

fcevado / phone Goto Github PK

View Code? Open in Web Editor NEW
105.0 7.0 36.0 590 KB

Elixir phone number parser for numbers in international standard.

License: Other

Elixir 100.00%
phone countries international elixir phone-number-parser telephone telephone-number telephone-number-parser

phone's People

Contributors

aarongraham avatar aaronrenner avatar alxgnon avatar boza avatar bsanyi avatar chakming avatar darwintantuco avatar davekapp avatar davidkovsky avatar divijjain avatar fcevado avatar feliperenan avatar gabrieltaylor avatar gjaldon avatar gorkunov avatar hobertro avatar jedschneider avatar kianmeng avatar luhalvesbr avatar mrjfernando avatar ne1ro avatar net avatar nicolafiorillo avatar riebeekn avatar szymon-jez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

phone's Issues

Does it work for mobile phones?

hi!

Thanks for your library, it seems great :)

I was trying to parse mobile phones from Spain, but it doesn't work (I think)

Phone.parse "+34600111111"
{:error, "Not a valid phone number."}

Is that expected and only work for landlines?

Thanks!

Incorrect specs for parse/2

Hi,
I've noticed that parse/2 function has incorrect spec:

  @spec parse(String.t(), Atom.t()) :: {:ok, Map.t()}
  @spec parse(pos_integer, Atom.t()) :: {:ok, Map.t()}
  @spec parse!(String.t(), Atom.t()) :: Map.t()
  @spec parse!(pos_integer, Atom.t()) :: Map.t()
  country_parser()

It can return different result on error:

iex(4)> Phone.parse("12345678a", :ee)
{:error, "Not a valid phone number."}

This can be observed on version 0.5.1

Issue parsing Irish phone numbers

I am having an issue getting irish phone numbers to parse correctly. I'm not sure what part of the phone number is the "area code", but here are some sample phone numbers.

+353 1 276 1923 - McDonald's, Bray, County Wicklow, Ireland
+353 402 39874 - McDonald's, Arklow, County Wicklow, Ireland
+353 1 872 4487 - McDonald's, 62 O'Connell Street Upper Dublin Dublin 1 O'Connell Street Upper, North City, Dublin 1, Ireland

Also what do you think about creating a test file for each country with sample phone numbers in it? For example, Ireland's tests would be in test/phone/ie_test.exs.

Brazilian mobile phone numbers cannot be parsed

While trying to parse a brazilian mobile phone number (2-digit country code + 2-digit local area code + 9-digit phone number), I've got this error:

Phone.parse("+5511912345678")
#=> {:error, "Not a valid phone number."}

Using invalid phone numbers in testing.

I was wondering if you'd considered a feature that would "turn off" area code checking in certain environments via a configuration option. I typically use invalid phone numbers (ex. +1-555-555-5555) in testing intentionally to avoid the chance of accidentally sending out a real SMS or telephone call. Invalid phone numbers are also used by Twilio for testing (https://www.twilio.com/docs/api/rest/test-credentials). I think it would be valuable to have this feature for testing purposes.

Is this something you would consider adding to the library?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.