One shot methods

This set of methods is a relic of the early development of dialr, and will be deprecated in future. They are significantly slower than the current approach.

The one shot methods parse the provided phone number during the processing function call. A country code must be provided in all cases to parse the provided numbers.

library(dialr)

x <- c(0, 0123, "0404 753 123", "61410123817", "+12015550123")

ph_valid(x, "AU")    # Is the phone number valid?
#> [1]    NA FALSE  TRUE  TRUE  TRUE
ph_possible(x, "AU") # Is the phone number possible?
#> [1] FALSE FALSE  TRUE  TRUE  TRUE
ph_region(x, "AU")   # What region (ISO country code) is the phone number from?
#> [1] NA   NA   "AU" "AU" "US"
ph_type(x, "AU")     # Is the phone number a fixed line, mobile etc.
#> [1] NA                     "UNKNOWN"              "MOBILE"              
#> [4] "MOBILE"               "FIXED_LINE_OR_MOBILE"
ph_format(x, "AU")
#> [1] NA               "123"            "0404 753 123"   "0410 123 817"  
#> [5] "(201) 555-0123"
ph_format(x, "AU", home = "AU")
#> [1] NA                    "123"                 "0404 753 123"       
#> [4] "0410 123 817"        "0011 1 201-555-0123"