-
-
Save mccraigmccraig/038776041d6d49e27bb6a7536bd8baf2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns er-model.util.phone-number.impl | |
(:require | |
["google-libphonenumber" | |
:refer [PhoneNumber | |
PhoneNumberUtil | |
PhoneNumberFormat]])) | |
(defn phone-number-instance [] (PhoneNumber.)) | |
(defn phone-number-util-instance [] (.getInstance PhoneNumberUtil)) | |
(def key->country-code-source-map | |
(let [ccs (.-CountryCodeSource PhoneNumber)] | |
{:from-number-with-plus-sign | |
(.-FROM_NUMBER_WITH_PLUS_SIGN ccs) | |
:from-number-with-idd | |
(.-FROM_NUMBER_WITH_IDD ccs) | |
:from-number-without-plus-sign | |
(.-FROM_NUMBER_WITHOUT_PLUS_SIGN ccs) | |
:from-default-country | |
(.-FROM_DEFAULT_COUNTRY ccs)})) | |
(def key->phone-number-format-map | |
{:E164 (.-E164 PhoneNumberFormat) | |
:INTERNATIONAL (.-INTERNATIONAL PhoneNumberFormat) | |
:NATIONAL (.-NATIONAL PhoneNumberFormat)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment