-
-
Save mccraigmccraig/1e8dafda6d86ea6ae0018b492992ee40 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" :as phone-number :refer [PhoneNumber]])) | |
(def PhoneNumberUtil (.-PhoneNumberUtil phone-number)) | |
(def PhoneNumberFormat (.-PhoneNumberFormat phone-number)) | |
(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