-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.randomseed.bankster.util.html
20 lines (20 loc) · 23.1 KB
/
io.randomseed.bankster.util.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>io.randomseed.bankster.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">Bankster</span> <span class="project-version">1.2.16</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="20_data_structures.html"><div class="inner"><span>Data Structures</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>randomseed</span></div></div></li><li class="depth-3"><a href="io.randomseed.bankster.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bankster</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.config.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>config</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.currency.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>currency</span></div></a></li><li class="depth-4"><a href="io.randomseed.bankster.money.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>money</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.bankster.money.inter-ops.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>inter-ops</span></div></a></li><li class="depth-5"><a href="io.randomseed.bankster.money.ops.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ops</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.registry.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>registry</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.scale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scale</span></div></a></li><li class="depth-4 current"><a href="io.randomseed.bankster.util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>util</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.bankster.util.fs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fs</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.bankster.util.importer.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>importer</span></div></a></li><li class="depth-5"><a href="io.randomseed.bankster.util.map.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>map</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="io.randomseed.bankster.util.html#var-bytes-concat"><div class="inner"><span>bytes-concat</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-bytes-to-string"><div class="inner"><span>bytes-to-string</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-bzero"><div class="inner"><span>bzero</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-char-ranges-.3Eset"><div class="inner"><span>char-ranges->set</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-count-digits"><div class="inner"><span>count-digits</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-current-thread"><div class="inner"><span>current-thread</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-current-thread-id"><div class="inner"><span>current-thread-id</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-current-thread-name"><div class="inner"><span>current-thread-name</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-ensure-keyword"><div class="inner"><span>ensure-keyword</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-ensure-keyword-having-ns"><div class="inner"><span>ensure-keyword-having-ns</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-gen-digits"><div class="inner"><span>gen-digits</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-get-rand-int"><div class="inner"><span>get-rand-int</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-get-rand-nth"><div class="inner"><span>get-rand-nth</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-inferred-contains.3F"><div class="inner"><span>inferred-contains?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-inferred-get"><div class="inner"><span>inferred-get</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-is"><div class="inner"><span>is</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-is-not"><div class="inner"><span>is-not</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-juxt-seq"><div class="inner"><span>juxt-seq</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-lazy-iterator-seq"><div class="inner"><span>lazy-iterator-seq</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-must-have-ns"><div class="inner"><span>must-have-ns</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-ns-infer"><div class="inner"><span>ns-infer</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-random-digits-len"><div class="inner"><span>random-digits-len</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-replace-in-set"><div class="inner"><span>replace-in-set</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-some-string"><div class="inner"><span>some-string</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-text-to-bytes"><div class="inner"><span>text-to-bytes</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-to-bytes"><div class="inner"><span>to-bytes</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-to-long"><div class="inner"><span>to-long</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-try-null"><div class="inner"><span>try-null</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-try-parse-int"><div class="inner"><span>try-parse-int</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-try-parse-long"><div class="inner"><span>try-parse-long</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-try-upper-case"><div class="inner"><span>try-upper-case</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-uuid"><div class="inner"><span>uuid</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.html#var-when-not-empty"><div class="inner"><span>when-not-empty</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.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">io.randomseed.bankster.util</h1><h4 class="added">added in 1.0.0</h4><div class="doc"><div class="markdown"><p>Support functions and macros.</p>
</div></div><div class="public anchor" id="var-bytes-concat"><h3>bytes-concat</h3><div class="usage"><code>(bytes-concat)</code><code>(bytes-concat bary)</code><code>(bytes-concat bary & byte-arys)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L241">view source</a></div></div><div class="public anchor" id="var-bytes-to-string"><h3>bytes-to-string</h3><div class="usage"><code>(bytes-to-string b)</code></div><div class="doc"><div class="markdown"><p>Converts bytes into a string</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L235">view source</a></div></div><div class="public anchor" id="var-bzero"><h3>bzero</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L232">view source</a></div></div><div class="public anchor" id="var-char-ranges-.3Eset"><h3>char-ranges->set</h3><h4 class="added">added in 1.0.0</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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L215">view source</a></div></div><div class="public anchor" id="var-count-digits"><h3>count-digits</h3><h4 class="added">added in 1.0.0</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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L81">view source</a></div></div><div class="public anchor" id="var-current-thread"><h3>current-thread</h3><div class="usage"><code>(current-thread)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L136">view source</a></div></div><div class="public anchor" id="var-current-thread-id"><h3>current-thread-id</h3><div class="usage"><code>(current-thread-id)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L134">view source</a></div></div><div class="public anchor" id="var-current-thread-name"><h3>current-thread-name</h3><div class="usage"><code>(current-thread-name)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L135">view source</a></div></div><div class="public anchor" id="var-ensure-keyword"><h3>ensure-keyword</h3><div class="usage"><code>(ensure-keyword id)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L36">view source</a></div></div><div class="public anchor" id="var-ensure-keyword-having-ns"><h3>ensure-keyword-having-ns</h3><div class="usage"><code>(ensure-keyword-having-ns id ns)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L46">view source</a></div></div><div class="public anchor" id="var-gen-digits"><h3>gen-digits</h3><h4 class="added">added in 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L178">view source</a></div></div><div class="public anchor" id="var-get-rand-int"><h3>get-rand-int</h3><h4 class="added">added in 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L138">view source</a></div></div><div class="public anchor" id="var-get-rand-nth"><h3>get-rand-nth</h3><h4 class="added">added in 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L192">view source</a></div></div><div class="public anchor" id="var-inferred-contains.3F"><h3>inferred-contains?</h3><h4 class="added">added in 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L103">view source</a></div></div><div class="public anchor" id="var-inferred-get"><h3>inferred-get</h3><h4 class="added">added in 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L114">view source</a></div></div><div class="public anchor" id="var-is"><h3>is</h3><h4 class="type">macro</h4><div class="usage"><code>(is pred val & body)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L71">view source</a></div></div><div class="public anchor" id="var-is-not"><h3>is-not</h3><h4 class="type">macro</h4><div class="usage"><code>(is-not pred val & body)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L76">view source</a></div></div><div class="public anchor" id="var-juxt-seq"><h3>juxt-seq</h3><div class="usage"><code>(juxt-seq & functions)</code></div><div class="doc"><div class="markdown"><p>Like juxt but returns a lazy sequence.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L267">view source</a></div></div><div class="public anchor" id="var-lazy-iterator-seq"><h3>lazy-iterator-seq</h3><h4 class="added">added in 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L205">view source</a></div></div><div class="public anchor" id="var-must-have-ns"><h3>must-have-ns</h3><div class="usage"><code>(must-have-ns id ns)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L29">view source</a></div></div><div class="public anchor" id="var-ns-infer"><h3>ns-infer</h3><h4 class="added">added in 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L88">view source</a></div></div><div class="public anchor" id="var-random-digits-len"><h3>random-digits-len</h3><h4 class="added">added in 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L151">view source</a></div></div><div class="public anchor" id="var-replace-in-set"><h3>replace-in-set</h3><div class="usage"><code>(replace-in-set s old-val new-val)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L129">view source</a></div></div><div class="public anchor" id="var-some-string"><h3>some-string</h3><div class="usage"><code>(some-string s)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L224">view source</a></div></div><div class="public anchor" id="var-text-to-bytes"><h3>text-to-bytes</h3><div class="usage"><code>(text-to-bytes t)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L254">view source</a></div></div><div class="public anchor" id="var-to-bytes"><h3>to-bytes</h3><div class="usage"><code>(to-bytes obj)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L228">view source</a></div></div><div class="public anchor" id="var-to-long"><h3>to-long</h3><div class="usage"><code>(to-long s default)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L258">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 1.0.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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L50">view source</a></div></div><div class="public anchor" id="var-try-parse-int"><h3>try-parse-int</h3><div class="usage"><code>(try-parse-int s)</code></div><div class="doc"><div class="markdown"><p>Returns integer from an object or nil if the given object does not contain valid integer.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L281">view source</a></div></div><div class="public anchor" id="var-try-parse-long"><h3>try-parse-long</h3><div class="usage"><code>(try-parse-long s)</code></div><div class="doc"><div class="markdown"><p>Returns long from an object or nil if the given object does not contain valid long.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L292">view source</a></div></div><div class="public anchor" id="var-try-upper-case"><h3>try-upper-case</h3><div class="usage"><code>(try-upper-case s)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L277">view source</a></div></div><div class="public anchor" id="var-uuid"><h3>uuid</h3><div class="usage"><code>(uuid s)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L273">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 1.0.0</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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L58">view source</a></div></div><div class="public anchor" id="var-with-not-empty"><h3>with-not-empty</h3><h4 class="added">added in 1.0.0</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/bankster/blob/1.2.16/src/io/randomseed/bankster/util.clj#L65">view source</a></div></div></div></body></html>