-
Notifications
You must be signed in to change notification settings - Fork 21
/
jssm_util.html
40 lines (40 loc) · 41.9 KB
/
jssm_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
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>jssm_util | JSSM, a JavaScript state machine - the FSM for FSL</title><meta name="description" content="Documentation for JSSM, a JavaScript state machine - the FSM for FSL"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><link rel="stylesheet" href="../assets/custom.css"/><script async src="../assets/search.js" id="search-script"></script><link rel="stylesheet" href="../assets/pages.css"/></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">JSSM, a JavaScript state machine - the FSM for FSL</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../modules.html">JSSM, a JavaScript state machine - the FSM for FSL</a></li><li><a href="jssm_util.html">jssm_util</a></li></ul><h1>Module jssm_util </h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Variables</h3><ul class="tsd-index-list"><li class="tsd-kind-variable tsd-parent-kind-module"><a href="jssm_util.html#histograph" class="tsd-kind-icon">histograph</a></li><li class="tsd-kind-variable tsd-parent-kind-module"><a href="jssm_util.html#weighted_histo_key" class="tsd-kind-icon">weighted_<wbr/>histo_<wbr/>key</a></li><li class="tsd-kind-variable tsd-parent-kind-module"><a href="jssm_util.html#weighted_rand_select" class="tsd-kind-icon">weighted_<wbr/>rand_<wbr/>select</a></li><li class="tsd-kind-variable tsd-parent-kind-module"><a href="jssm_util.html#weighted_sample_select" class="tsd-kind-icon">weighted_<wbr/>sample_<wbr/>select</a></li></ul></section><section class="tsd-index-section "><h3>Functions</h3><ul class="tsd-index-list"><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="jssm_util.html#arr_uniq_p" class="tsd-kind-icon">arr_<wbr/>uniq_<wbr/>p</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#array_box_if_string" class="tsd-kind-icon">array_<wbr/>box_<wbr/>if_<wbr/>string</a></li><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="jssm_util.html#find_repeated" class="tsd-kind-icon">find_<wbr/>repeated</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#hook_name" class="tsd-kind-icon">hook_<wbr/>name</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#make_mulberry_rand" class="tsd-kind-icon">make_<wbr/>mulberry_<wbr/>rand</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#name_bind_prop_and_state" class="tsd-kind-icon">name_<wbr/>bind_<wbr/>prop_<wbr/>and_<wbr/>state</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#named_hook_name" class="tsd-kind-icon">named_<wbr/>hook_<wbr/>name</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#seq" class="tsd-kind-icon">seq</a></li><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="jssm_util.html#unique" class="tsd-kind-icon">unique</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Variables</h2><section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-module"><a id="histograph" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> histograph<a href="#histograph" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">histograph<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L108">src/ts/jssm_util.ts:108</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Returns the histograph of an array as a <code>Map</code>. Makes no attempt to cope
with deep equality; will fail for complex contents, as such.</p>
</div><div><pre><code class="language-typescript"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">histograph</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">'./jssm'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">histograph</span><span class="hl-1">( [</span><span class="hl-8">0</span><span class="hl-1">, </span><span class="hl-8">0</span><span class="hl-1">, </span><span class="hl-8">1</span><span class="hl-1">, </span><span class="hl-8">1</span><span class="hl-1">, </span><span class="hl-8">2</span><span class="hl-1">, </span><span class="hl-8">2</span><span class="hl-1">, </span><span class="hl-8">1</span><span class="hl-1">] ); </span><span class="hl-7">// Map()</span>
</code></pre>
</div></div></section><section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-module"><a id="weighted_histo_key" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> weighted_<wbr/>histo_<wbr/>key<a href="#weighted_histo_key" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">weighted_<wbr/>histo_<wbr/>key<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L132">src/ts/jssm_util.ts:132</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-module"><a id="weighted_rand_select" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> weighted_<wbr/>rand_<wbr/>select<a href="#weighted_rand_select" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">weighted_<wbr/>rand_<wbr/>select<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L33">src/ts/jssm_util.ts:33</a></li></ul></aside></section><section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-module"><a id="weighted_sample_select" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> weighted_<wbr/>sample_<wbr/>select<a href="#weighted_sample_select" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">weighted_<wbr/>sample_<wbr/>select<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Function</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L121">src/ts/jssm_util.ts:121</a></li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group "><h2>Functions</h2><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a id="arr_uniq_p" class="tsd-anchor"></a><h3 class="tsd-anchor-link">arr_<wbr/>uniq_<wbr/>p<a href="#arr_uniq_p" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><li class="tsd-signature tsd-kind-icon">arr_<wbr/>uniq_<wbr/>p<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span>el<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span>, i<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, source<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L15">src/ts/jssm_util.ts:15</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Predicate for validating an array for uniqueness. Not generally meant for
external use.</p>
</div></div><h4 class="tsd-type-parameters-title">Type Parameters</h4><ul class="tsd-type-parameters"><li><h4>T</h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>el: <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span></h5></li><li><h5>i: <span class="tsd-signature-type">number</span></h5></li><li><h5>source: <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="array_box_if_string" class="tsd-anchor"></a><h3 class="tsd-anchor-link">array_<wbr/>box_<wbr/>if_<wbr/>string<a href="#array_box_if_string" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">array_<wbr/>box_<wbr/>if_<wbr/>string<span class="tsd-signature-symbol">(</span>n<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L23">src/ts/jssm_util.ts:23</a></li></ul></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>n: <span class="tsd-signature-type">any</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a id="find_repeated" class="tsd-anchor"></a><h3 class="tsd-anchor-link">find_<wbr/>repeated<a href="#find_repeated" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><li class="tsd-signature tsd-kind-icon">find_<wbr/>repeated<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span>arr<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">[]</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L270">src/ts/jssm_util.ts:270</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Lists all repeated items in an array along with their counts. Subject to
matching rules of Map. <code>NaN</code> is manually removed because of conflict rules
around <a href="jssm_util.html#unique">unique</a>. Because these are compared with <code>===</code> and because
arrays and objects never match that way unless they're the same object,
arrays and objects are never considered repeats.</p>
</div><div><pre><code class="language-typescript"><span class="hl-6">find_repeated</span><span class="hl-1"><</span><span class="hl-9">string</span><span class="hl-1">>([ ]); </span><span class="hl-7">// []</span><br/><span class="hl-6">find_repeated</span><span class="hl-1"><</span><span class="hl-9">string</span><span class="hl-1">>([ </span><span class="hl-3">"one"</span><span class="hl-1"> ]); </span><span class="hl-7">// []</span><br/><span class="hl-6">find_repeated</span><span class="hl-1"><</span><span class="hl-9">string</span><span class="hl-1">>([ </span><span class="hl-3">"one"</span><span class="hl-1">, </span><span class="hl-3">"two"</span><span class="hl-1"> ]); </span><span class="hl-7">// []</span><br/><span class="hl-6">find_repeated</span><span class="hl-1"><</span><span class="hl-9">string</span><span class="hl-1">>([ </span><span class="hl-3">"one"</span><span class="hl-1">, </span><span class="hl-3">"one"</span><span class="hl-1"> ]); </span><span class="hl-7">// [ ["one", 2] ]</span><br/><span class="hl-6">find_repeated</span><span class="hl-1"><</span><span class="hl-9">string</span><span class="hl-1">>([ </span><span class="hl-3">"one"</span><span class="hl-1">, </span><span class="hl-3">"two"</span><span class="hl-1">, </span><span class="hl-3">"one"</span><span class="hl-1"> ]); </span><span class="hl-7">// [ ["one", 2] ]</span><br/><span class="hl-6">find_repeated</span><span class="hl-1"><</span><span class="hl-9">number</span><span class="hl-1">>([ </span><span class="hl-8">0</span><span class="hl-1">, </span><span class="hl-4">NaN</span><span class="hl-1">, </span><span class="hl-8">0</span><span class="hl-1">, </span><span class="hl-4">NaN</span><span class="hl-1"> ]); </span><span class="hl-7">// [ [0, 2] ]</span>
</code></pre>
</div></div><h4 class="tsd-type-parameters-title">Type Parameters</h4><ul class="tsd-type-parameters"><li><h4>T</h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>arr: <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">[]</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="hook_name" class="tsd-anchor"></a><h3 class="tsd-anchor-link">hook_<wbr/>name<a href="#hook_name" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">hook_<wbr/>name<span class="tsd-signature-symbol">(</span>from<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, to<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L177">src/ts/jssm_util.ts:177</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Internal method generating names for edges for the hook lookup map. Not
meant for external use.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>from: <span class="tsd-signature-type">string</span></h5></li><li><h5>to: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="make_mulberry_rand" class="tsd-anchor"></a><h3 class="tsd-anchor-link">make_<wbr/>mulberry_<wbr/>rand<a href="#make_mulberry_rand" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">make_<wbr/>mulberry_<wbr/>rand<span class="tsd-signature-symbol">(</span>a<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L208">src/ts/jssm_util.ts:208</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Creates a Mulberry32 random generator. Used by the randomness test suite.</p>
</div><div><p> Sourced from <code>bryc</code> at StackOverflow: <a href="https://stackoverflow.com/a/47593316/763127">https://stackoverflow.com/a/47593316/763127</a></p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> a: <span class="tsd-signature-type">number</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> => </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span></h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures tsd-kind-type-literal"><li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4></li></ul></li></ul></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="name_bind_prop_and_state" class="tsd-anchor"></a><h3 class="tsd-anchor-link">name_<wbr/>bind_<wbr/>prop_<wbr/>and_<wbr/>state<a href="#name_bind_prop_and_state" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">name_<wbr/>bind_<wbr/>prop_<wbr/>and_<wbr/>state<span class="tsd-signature-symbol">(</span>prop<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, state<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L152">src/ts/jssm_util.ts:152</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Internal method generating names for edges for the hook lookup map. Not
meant for external use.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>prop: <span class="tsd-signature-type">string</span></h5></li><li><h5>state: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="named_hook_name" class="tsd-anchor"></a><h3 class="tsd-anchor-link">named_<wbr/>hook_<wbr/>name<a href="#named_hook_name" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">named_<wbr/>hook_<wbr/>name<span class="tsd-signature-symbol">(</span>from<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, to<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, action<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L192">src/ts/jssm_util.ts:192</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Internal method generating names for actions for the hook lookup map. Not
meant for external use.</p>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>from: <span class="tsd-signature-type">string</span></h5></li><li><h5>to: <span class="tsd-signature-type">string</span></h5></li><li><h5>action: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="seq" class="tsd-anchor"></a><h3 class="tsd-anchor-link">seq<a href="#seq" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">seq<span class="tsd-signature-symbol">(</span>n<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L75">src/ts/jssm_util.ts:75</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Returns, for a non-negative integer argument <code>n</code>, the series <code>[0 .. n]</code>.</p>
</div><div><pre><code class="language-typescript"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">seq</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">'./jssm'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">seq</span><span class="hl-1">(</span><span class="hl-8">5</span><span class="hl-1">); </span><span class="hl-7">// [0, 1, 2, 3, 4]</span><br/><span class="hl-6">seq</span><span class="hl-1">(</span><span class="hl-8">0</span><span class="hl-1">); </span><span class="hl-7">// []</span>
</code></pre>
</div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>n: <span class="tsd-signature-type">number</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">[]</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a id="unique" class="tsd-anchor"></a><h3 class="tsd-anchor-link">unique<a href="#unique" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><li class="tsd-signature tsd-kind-icon">unique<span class="tsd-signature-symbol"><</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span>arr<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">[]</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/StoneCypher/jssm/blob/b49af31/src/ts/jssm_util.ts#L243">src/ts/jssm_util.ts:243</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead">
<p> Reduces an array to its unique contents. Compares with <code>===</code> and makes no
effort to deep-compare contents; two matching arrays or objects contained
will be treated as distinct, according to javascript rules. This also means
that <code>NaNs</code> will be <em><strong>dropped</strong></em>, because they do not self-compare.</p>
</div><div><pre><code class="language-typescript"><span class="hl-6">unique</span><span class="hl-1">( [] ); </span><span class="hl-7">// []</span><br/><span class="hl-6">unique</span><span class="hl-1">( [</span><span class="hl-8">0</span><span class="hl-1">,</span><span class="hl-8">0</span><span class="hl-1">] ); </span><span class="hl-7">// [0]</span><br/><span class="hl-6">unique</span><span class="hl-1">( [</span><span class="hl-8">0</span><span class="hl-1">,</span><span class="hl-8">1</span><span class="hl-1">,</span><span class="hl-8">2</span><span class="hl-1">, </span><span class="hl-8">0</span><span class="hl-1">,</span><span class="hl-8">1</span><span class="hl-1">,</span><span class="hl-8">2</span><span class="hl-1">, </span><span class="hl-8">0</span><span class="hl-1">,</span><span class="hl-8">1</span><span class="hl-1">,</span><span class="hl-8">2</span><span class="hl-1">] ); </span><span class="hl-7">// [0,1,2]</span><br/><span class="hl-6">unique</span><span class="hl-1">( [ [</span><span class="hl-8">1</span><span class="hl-1">], [</span><span class="hl-8">1</span><span class="hl-1">] ] ); </span><span class="hl-7">// [ [1], [1] ] because arrays don't match</span><br/><span class="hl-6">unique</span><span class="hl-1">( [</span><span class="hl-8">0</span><span class="hl-1">,</span><span class="hl-4">NaN</span><span class="hl-1">,</span><span class="hl-8">2</span><span class="hl-1">] ); </span><span class="hl-7">// [0,2]</span>
</code></pre>
</div></div><h4 class="tsd-type-parameters-title">Type Parameters</h4><ul class="tsd-type-parameters"><li><h4>T</h4></li></ul><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5><span class="tsd-flag ts-flagOptional">Optional</span> arr: <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type" data-tsd-kind="Type parameter">T</span><span class="tsd-signature-symbol">[]</span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../modules.html">Modules</a></li><li class=" pages-entry pages-entry-menu pages-entry-depth-0"><a>Tutorials</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-1"><a href="../pages/WhatAreStateMachines.html">What are state machines?</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-1"><a href="../pages/GettingStarted.html">☕ <wbr/>Quick <wbr/>Start</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-1"><a href="../pages/LanguageReference.html">Language reference</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-1"><a href="../pages/todo.html">API reference</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-1"><a href="../pages/ExampleMachines.html">Example machines</a></li><li class=" pages-entry pages-entry-menu pages-entry-depth-1"><a>Howtos and <wbr/>Recipes</a></li><li class=" pages-entry pages-entry-menu pages-entry-depth-2"><a>Frameworks</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">React</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">Vue</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">Angular</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">Node</a></li><li class=" pages-entry pages-entry-menu pages-entry-depth-2"><a>Environments</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">Node</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">Typescript</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">The browser</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">AWS <wbr/>Lambda</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">SQL</a></li><li class=" pages-entry pages-entry-menu pages-entry-depth-2"><a>Bundling</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">Rollup</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">Webpack</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">CDN</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-3"><a href="../pages/todo.html">Local files</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-2"><a href="../pages/todo.html">Let's make a large machine</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-2"><a href="../pages/todo.html">Publishing</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-2"><a href="../pages/Styling.html">Theme, style, color</a></li><li class=" pages-entry pages-entry-menu pages-entry-depth-1"><a>Comparisons</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-2"><a href="../pages/FeatureComparison.html">Feature comparison</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-2"><a href="../pages/Shootout.html">LOC <wbr/>Shootout</a></li><li class=" pages-entry pages-entry-menu pages-entry-depth-0"><a>Tools</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-1"><a href="../pages/live_editor.html">Live <wbr/>Editor</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-1"><a href="../pages/todo.html">Github <wbr/>Action</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-1"><a href="../pages/todo.html">CLI</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-0"><a href="../pages/community.html">Community</a></li><li class=" pages-entry pages-entry-page pages-entry-depth-0"><a href="../pages/CHANGELOG.long.html">Changelog</a></li><li class=" tsd-kind-module"><a href="jssm.html">jssm</a></li><li class=" tsd-kind-module"><a href="jssm_constants.html">jssm_<wbr/>constants</a></li><li class=" tsd-kind-module"><a href="jssm_error.html">jssm_<wbr/>error</a></li><li class=" tsd-kind-module"><a href="jssm_types.html">jssm_<wbr/>types</a></li><li class="current tsd-kind-module"><a href="jssm_util.html">jssm_<wbr/>util</a></li><li class=" tsd-kind-module"><a href="version.html">version</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-variable tsd-parent-kind-module"><a href="jssm_util.html#histograph" class="tsd-kind-icon">histograph</a></li><li class="tsd-kind-variable tsd-parent-kind-module"><a href="jssm_util.html#weighted_histo_key" class="tsd-kind-icon">weighted_<wbr/>histo_<wbr/>key</a></li><li class="tsd-kind-variable tsd-parent-kind-module"><a href="jssm_util.html#weighted_rand_select" class="tsd-kind-icon">weighted_<wbr/>rand_<wbr/>select</a></li><li class="tsd-kind-variable tsd-parent-kind-module"><a href="jssm_util.html#weighted_sample_select" class="tsd-kind-icon">weighted_<wbr/>sample_<wbr/>select</a></li><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="jssm_util.html#arr_uniq_p" class="tsd-kind-icon">arr_<wbr/>uniq_<wbr/>p</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#array_box_if_string" class="tsd-kind-icon">array_<wbr/>box_<wbr/>if_<wbr/>string</a></li><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="jssm_util.html#find_repeated" class="tsd-kind-icon">find_<wbr/>repeated</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#hook_name" class="tsd-kind-icon">hook_<wbr/>name</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#make_mulberry_rand" class="tsd-kind-icon">make_<wbr/>mulberry_<wbr/>rand</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#name_bind_prop_and_state" class="tsd-kind-icon">name_<wbr/>bind_<wbr/>prop_<wbr/>and_<wbr/>state</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#named_hook_name" class="tsd-kind-icon">named_<wbr/>hook_<wbr/>name</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="jssm_util.html#seq" class="tsd-kind-icon">seq</a></li><li class="tsd-kind-function tsd-parent-kind-module tsd-has-type-parameter"><a href="jssm_util.html#unique" class="tsd-kind-icon">unique</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-namespace"><span class="tsd-kind-icon">Namespace</span></li><li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li><li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li><li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li><li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li><li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li><li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>