-
Notifications
You must be signed in to change notification settings - Fork 0
/
phone-number.util.html
27 lines (27 loc) · 22.9 KB
/
phone-number.util.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>phone-number.util documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Phone-number</span> <span class="project-version">8.13.6-3</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="10_introduction.html"><div class="inner"><span>Introduction</span></div></a></li><li class="depth-1 "><a href="30_specs.html"><div class="inner"><span>Specs and checks</span></div></a></li><li class="depth-1 "><a href="40_development.html"><div class="inner"><span>Development</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><a href="phone-number.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>phone-number</span></div></a></li><li class="depth-2 branch"><a href="phone-number.calling-code.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>calling-code</span></div></a></li><li class="depth-2 branch"><a href="phone-number.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="phone-number.cost.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>cost</span></div></a></li><li class="depth-2 branch"><a href="phone-number.country-code.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>country-code</span></div></a></li><li class="depth-2 branch"><a href="phone-number.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-2 branch"><a href="phone-number.format.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>format</span></div></a></li><li class="depth-2 branch"><a href="phone-number.leniency.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>leniency</span></div></a></li><li class="depth-2 branch"><a href="phone-number.locale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>locale</span></div></a></li><li class="depth-2 branch"><a href="phone-number.match.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>match</span></div></a></li><li class="depth-2 branch"><a href="phone-number.net-code.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>net-code</span></div></a></li><li class="depth-2 branch"><a href="phone-number.region.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>region</span></div></a></li><li class="depth-2 branch"><a href="phone-number.type.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>type</span></div></a></li><li class="depth-2 branch"><a href="phone-number.tz-format.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>tz-format</span></div></a></li><li class="depth-2 current"><a href="phone-number.util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>util</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="phone-number.util.html#var-available-locales"><div class="inner"><span>available-locales</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-available-locales-vec"><div class="inner"><span>available-locales-vec</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-carrier-mapper"><div class="inner"><span>carrier-mapper</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-char-ranges-.3Eset"><div class="inner"><span>char-ranges->set</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-count-digits"><div class="inner"><span>count-digits</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-fmap-k"><div class="inner"><span>fmap-k</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-fmap-v"><div class="inner"><span>fmap-v</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-gen-digits"><div class="inner"><span>gen-digits</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-gen-is"><div class="inner"><span>gen-is</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-gen-ises"><div class="inner"><span>gen-ises</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-geo-coder"><div class="inner"><span>geo-coder</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-get-rand-int"><div class="inner"><span>get-rand-int</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-get-rand-nth"><div class="inner"><span>get-rand-nth</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-inferred-contains.3F"><div class="inner"><span>inferred-contains?</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-inferred-get"><div class="inner"><span>inferred-get</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-instance"><div class="inner"><span>instance</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-lazy-iterator-seq"><div class="inner"><span>lazy-iterator-seq</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-map-of-sets-invert"><div class="inner"><span>map-of-sets-invert</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-ns-infer"><div class="inner"><span>ns-infer</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-random-digits-len"><div class="inner"><span>random-digits-len</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-remove-empty-vals"><div class="inner"><span>remove-empty-vals</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-short"><div class="inner"><span>short</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-time-zones-mapper"><div class="inner"><span>time-zones-mapper</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-try-null"><div class="inner"><span>try-null</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-try-parse"><div class="inner"><span>try-parse</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-try-parse-or-false"><div class="inner"><span>try-parse-or-false</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-valid-locale.3F"><div class="inner"><span>valid-locale?</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-when-not-empty"><div class="inner"><span>when-not-empty</span></div></a></li><li class="depth-1"><a href="phone-number.util.html#var-with-not-empty"><div class="inner"><span>with-not-empty</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">phone-number.util</h1><h4 class="added">added in 8.12.4-0</h4><div class="doc"><div class="markdown"><p>Singleton wrappers and helpers for phone-number.</p>
</div></div><div class="public anchor" id="var-available-locales"><h3>available-locales</h3><h4 class="added">added in 8.12.4-1</h4><h4 class="deprecated">deprecated in 8.12.4-3</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>DEPRECATED: Please use <code>phone-number.locale/by-val-vec</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L313">view source</a></div></div><div class="public anchor" id="var-available-locales-vec"><h3>available-locales-vec</h3><h4 class="added">added in 8.12.4-1</h4><h4 class="deprecated">deprecated in 8.12.4-3</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>DEPRECATED: Please use <code>phone-number.locale/by-val-vec</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L318">view source</a></div></div><div class="public anchor" id="var-carrier-mapper"><h3>carrier-mapper</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(carrier-mapper)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L38">view source</a></div></div><div class="public anchor" id="var-char-ranges-.3Eset"><h3>char-ranges->set</h3><h4 class="added">added in 8.12.4-1</h4><div class="usage"><code>(char-ranges->set & ranges)</code></div><div class="doc"><div class="markdown"><p>Returns a set of characters defined as a collection of collections with start and stop character, e.g.: <a href="\0 \9">\A \Z</a></p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L302">view source</a></div></div><div class="public anchor" id="var-count-digits"><h3>count-digits</h3><h4 class="added">added in 8.12.4-1</h4><div class="usage"><code>(count-digits n)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L91">view source</a></div></div><div class="public anchor" id="var-fmap-k"><h3>fmap-k</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(fmap-k f m)</code><code>(fmap-k f m dst)</code></div><div class="doc"><div class="markdown"><p>For each key and value of the given map m calls a function passed as the first argument (passing successive keys during calls to it) and generates a map with values updated by the results returned by the function. When the third argument is given it should be a map on which operations are performed instead of using the original map. This may be helpful when we want to avoid merging the results with another map.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L139">view source</a></div></div><div class="public anchor" id="var-fmap-v"><h3>fmap-v</h3><h4 class="added">added in 8.12.16-1</h4><div class="usage"><code>(fmap-v f m)</code><code>(fmap-v f m dst)</code></div><div class="doc"><div class="markdown"><p>For each key and value of the given map m calls a function passed as the first argument (passing successive values during calls to it) and generates a map with values updated by the results returned by the function. When the third argument is given it should be a map on which operations are performed instead of using the original map. This may be helpful when we want to avoid merging the results with another map.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L157">view source</a></div></div><div class="public anchor" id="var-gen-digits"><h3>gen-digits</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(gen-digits num)</code><code>(gen-digits num rng)</code></div><div class="doc"><div class="markdown"><p>Generates the given number of random digits and converts all into a single string. When the second argument is present it should be an instance of random number generator used to get the digits.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L265">view source</a></div></div><div class="public anchor" id="var-gen-is"><h3>gen-is</h3><h4 class="type">macro</h4><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(gen-is k f)</code></div><div class="doc"><div class="markdown"><p>For the given keyword k and function name f uses gen-is-sexp to generate predicate function definitions.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L211">view source</a></div></div><div class="public anchor" id="var-gen-ises"><h3>gen-ises</h3><h4 class="type">macro</h4><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(gen-ises coll f)</code></div><div class="doc"><div class="markdown"><p>Takes a collection of keywords (evaluated) and a function expressed as a symbol (not evaluated) and generates bunch of function definitions using gen-is-sexp.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L218">view source</a></div></div><div class="public anchor" id="var-geo-coder"><h3>geo-coder</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(geo-coder)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L33">view source</a></div></div><div class="public anchor" id="var-get-rand-int"><h3>get-rand-int</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(get-rand-int n)</code><code>(get-rand-int n rng)</code></div><div class="doc"><div class="markdown"><p>Like rand-int but optionally uses random number generator.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L225">view source</a></div></div><div class="public anchor" id="var-get-rand-nth"><h3>get-rand-nth</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(get-rand-nth v)</code><code>(get-rand-nth v rng)</code></div><div class="doc"><div class="markdown"><p>Returns a random element of the given vector. When the second argument is present it should be an instance of random number generator used to get the random position.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L279">view source</a></div></div><div class="public anchor" id="var-inferred-contains.3F"><h3>inferred-contains?</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(inferred-contains? coll k)</code></div><div class="doc"><div class="markdown"><p>Just like the contains? but if the keyword is namespace-qualified it also checks if the collection contains the same keyword as its key but without a namespace.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L113">view source</a></div></div><div class="public anchor" id="var-inferred-get"><h3>inferred-get</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(inferred-get coll k)</code><code>(inferred-get coll k default)</code></div><div class="doc"><div class="markdown"><p>Just like the get function but if the keyword is namespace-qualified it first attempts to look for the value associated with it. If that fails it uses the variant of the keyword without any namespace.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L124">view source</a></div></div><div class="public anchor" id="var-instance"><h3>instance</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(instance)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L23">view source</a></div></div><div class="public anchor" id="var-lazy-iterator-seq"><h3>lazy-iterator-seq</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(lazy-iterator-seq coll)</code><code>(lazy-iterator-seq coll iter)</code></div><div class="doc"><div class="markdown"><p>Returns a lazy sequence as an interface to the given iterable Java object.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L292">view source</a></div></div><div class="public anchor" id="var-map-of-sets-invert"><h3>map-of-sets-invert</h3><h4 class="added">added in 8.12.16-1</h4><div class="usage"><code>(map-of-sets-invert m)</code></div><div class="doc"><div class="markdown"><p>Like <code>clojure.set/map-invert</code> but for map of sets (as values) to preserve all possible values (as keys of newly created map).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L175">view source</a></div></div><div class="public anchor" id="var-ns-infer"><h3>ns-infer</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(ns-infer ns-name k)</code><code>(ns-infer ns-name k use-infer)</code></div><div class="doc"><div class="markdown"><p>Takes a string of namespace name and a keyword. If the given keyword is not namespace-qualified it returns a new keyword with the given namespace added. If the given keyword is already equipped with a namespace it returns it.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L98">view source</a></div></div><div class="public anchor" id="var-random-digits-len"><h3>random-digits-len</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(random-digits-len x iteration shrink-now)</code><code>(random-digits-len x iteration shrink-now rng)</code></div><div class="doc"><div class="markdown"><p>For 0 or 1 it returns its argument. For other positive numbers it returns a random natural number from 1 to this number (inclusive) in 50% cases. In other 50% cases it returns its argument.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L238">view source</a></div></div><div class="public anchor" id="var-remove-empty-vals"><h3>remove-empty-vals</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(remove-empty-vals m)</code></div><div class="doc"><div class="markdown"><p>Removes empty values from a map.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L185">view source</a></div></div><div class="public anchor" id="var-short"><h3>short</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(short)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L28">view source</a></div></div><div class="public anchor" id="var-time-zones-mapper"><h3>time-zones-mapper</h3><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(time-zones-mapper)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L43">view source</a></div></div><div class="public anchor" id="var-try-null"><h3>try-null</h3><h4 class="type">macro</h4><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(try-null & body)</code></div><div class="doc"><div class="markdown"><p>Evaluates body and if NullPointerException exception is caught it returns nil. Otherwise it returns the value of last expression in the body.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L70">view source</a></div></div><div class="public anchor" id="var-try-parse"><h3>try-parse</h3><h4 class="type">macro</h4><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(try-parse & body)</code></div><div class="doc"><div class="markdown"><p>Evaluates body and if NumberParseException or NumberFormatException exception is caught it returns nil.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L50">view source</a></div></div><div class="public anchor" id="var-try-parse-or-false"><h3>try-parse-or-false</h3><h4 class="type">macro</h4><h4 class="added">added in 8.12.4-0</h4><div class="usage"><code>(try-parse-or-false & body)</code></div><div class="doc"><div class="markdown"><p>Evaluates body and if NumberParseException or NumberFormatException exception is caught it returns false.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L60">view source</a></div></div><div class="public anchor" id="var-valid-locale.3F"><h3>valid-locale?</h3><h4 class="added">added in 8.12.4-1</h4><h4 class="deprecated">deprecated in 8.12.4-3</h4><div class="usage"><code>(valid-locale? locale-specification)</code></div><div class="doc"><div class="markdown"><p>DEPRECATED: Please use <code>phone-number.locale/valid?</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L323">view source</a></div></div><div class="public anchor" id="var-when-not-empty"><h3>when-not-empty</h3><h4 class="type">macro</h4><h4 class="added">added in 8.12.16-1</h4><div class="usage"><code>(when-not-empty val & body)</code></div><div class="doc"><div class="markdown"><p>Evaluates body when the given value is a non-empty collection.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L78">view source</a></div></div><div class="public anchor" id="var-with-not-empty"><h3>with-not-empty</h3><h4 class="added">added in 8.12.16-1</h4><div class="usage"><code>(with-not-empty obj)</code></div><div class="doc"><div class="markdown"><p>Returns the collection if it’s not empty. Otherwise returns <code>nil</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/phone-number/tree/8.13.6-3/src/phone_number/util.clj#L85">view source</a></div></div></div></body></html>