Skip to content

Commit e612b93

Browse files
committed
v5.1.5
1 parent 4388cef commit e612b93

File tree

22 files changed

+539
-454
lines changed

22 files changed

+539
-454
lines changed

coverage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"tests":6852,"assertions":32075,"lines":{"total":2380,"covered":2380,"skipped":0,"pct":100},"statements":{"total":2567,"covered":2567,"skipped":0,"pct":100},"functions":{"total":1006,"covered":1006,"skipped":0,"pct":100},"branches":{"total":951,"covered":951,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
1+
{"tests":6853,"assertions":32079,"lines":{"total":2389,"covered":2389,"skipped":0,"pct":100},"statements":{"total":2576,"covered":2576,"skipped":0,"pct":100},"functions":{"total":1006,"covered":1006,"skipped":0,"pct":100},"branches":{"total":951,"covered":951,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}

docs/api/all.html

Lines changed: 12 additions & 1 deletion
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<nav><ul><li><a href="/">TinyBase</a></li><li><a href="/api/">API</a></li><li><a href="/api/common/"><code>common</code></a></li><li><a href="/api/common/functions/">Functions</a></li></ul></nav><section class="s1" id="/api/common/functions/" data-id="c3/F8"><h1>Functions</h1><p>These are the functions within the <a href="/api/common/"><code>common</code></a> module.</p><section class="s2" id="/api/common/functions/convenience/defaultsorter/" data-id="dS3"><h2><a href="/api/common/functions/convenience/defaultsorter/"><code>defaultSorter</code></a></h2><p>The <code>defaultSorter</code> function is provided as a convenience to sort keys alphanumerically, and can be provided to the <code>sliceIdSorter</code> and <code>rowIdSorter</code> parameters of the <a href="/api/indexes/interfaces/indexes/indexes/methods/configuration/setindexdefinition/"><code>setIndexDefinition</code></a> method in the <a href="/api/indexes/"><code>indexes</code></a> module, for example.</p><a href="/api/common/functions/convenience/defaultsorter/">Read more</a></section><section class="s2" id="/api/common/functions/convenience/getuniqueid/" data-id="gUI"><h2><a href="/api/common/functions/convenience/getuniqueid/"><code>getUniqueId</code></a></h2><p>The <code>getUniqueId</code> function.</p><a href="/api/common/functions/convenience/getuniqueid/">Read more</a></section></section>
1+
<nav><ul><li><a href="/">TinyBase</a></li><li><a href="/api/">API</a></li><li><a href="/api/common/"><code>common</code></a></li><li><a href="/api/common/functions/">Functions</a></li></ul></nav><section class="s1" id="/api/common/functions/" data-id="c3/F8"><h1>Functions</h1><p>These are the functions within the <a href="/api/common/"><code>common</code></a> module.</p><section class="s2" id="/api/common/functions/convenience/defaultsorter/" data-id="dS3"><h2><a href="/api/common/functions/convenience/defaultsorter/"><code>defaultSorter</code></a></h2><p>The <code>defaultSorter</code> function is provided as a convenience to sort keys alphanumerically, and can be provided to the <code>sliceIdSorter</code> and <code>rowIdSorter</code> parameters of the <a href="/api/indexes/interfaces/indexes/indexes/methods/configuration/setindexdefinition/"><code>setIndexDefinition</code></a> method in the <a href="/api/indexes/"><code>indexes</code></a> module, for example.</p><a href="/api/common/functions/convenience/defaultsorter/">Read more</a></section><section class="s2" id="/api/common/functions/convenience/getuniqueid/" data-id="gUI"><h2><a href="/api/common/functions/convenience/getuniqueid/"><code>getUniqueId</code></a></h2><p>The <code>getUniqueId</code> function returns a unique string of a given length.</p><a href="/api/common/functions/convenience/getuniqueid/">Read more</a></section></section>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<nav><ul><li><a href="/">TinyBase</a></li><li><a href="/api/">API</a></li><li><a href="/api/common/"><code>common</code></a></li><li><a href="/api/common/functions/">Functions</a></li></ul></nav><section class="s1" id="/api/common/functions/convenience/" data-id="c3/F8/C28"><h1>Convenience functions</h1><p>This is the collection of convenience functions within the <a href="/api/common/"><code>common</code></a> module. There are only two convenience functions, <a href="/api/common/functions/convenience/defaultsorter/"><code>defaultSorter</code></a> and <a href="/api/common/functions/convenience/getuniqueid/"><code>getUniqueId</code></a>.</p><section class="s2" id="/api/common/functions/convenience/defaultsorter/" data-id="dS3"><h2><a href="/api/common/functions/convenience/defaultsorter/"><code>defaultSorter</code></a></h2><p>The <code>defaultSorter</code> function is provided as a convenience to sort keys alphanumerically, and can be provided to the <code>sliceIdSorter</code> and <code>rowIdSorter</code> parameters of the <a href="/api/indexes/interfaces/indexes/indexes/methods/configuration/setindexdefinition/"><code>setIndexDefinition</code></a> method in the <a href="/api/indexes/"><code>indexes</code></a> module, for example.</p><a href="/api/common/functions/convenience/defaultsorter/">Read more</a></section><section class="s2" id="/api/common/functions/convenience/getuniqueid/" data-id="gUI"><h2><a href="/api/common/functions/convenience/getuniqueid/"><code>getUniqueId</code></a></h2><p>The <code>getUniqueId</code> function.</p><a href="/api/common/functions/convenience/getuniqueid/">Read more</a></section></section>
1+
<nav><ul><li><a href="/">TinyBase</a></li><li><a href="/api/">API</a></li><li><a href="/api/common/"><code>common</code></a></li><li><a href="/api/common/functions/">Functions</a></li></ul></nav><section class="s1" id="/api/common/functions/convenience/" data-id="c3/F8/C28"><h1>Convenience functions</h1><p>This is the collection of convenience functions within the <a href="/api/common/"><code>common</code></a> module. There are only two convenience functions, <a href="/api/common/functions/convenience/defaultsorter/"><code>defaultSorter</code></a> and <a href="/api/common/functions/convenience/getuniqueid/"><code>getUniqueId</code></a>.</p><section class="s2" id="/api/common/functions/convenience/defaultsorter/" data-id="dS3"><h2><a href="/api/common/functions/convenience/defaultsorter/"><code>defaultSorter</code></a></h2><p>The <code>defaultSorter</code> function is provided as a convenience to sort keys alphanumerically, and can be provided to the <code>sliceIdSorter</code> and <code>rowIdSorter</code> parameters of the <a href="/api/indexes/interfaces/indexes/indexes/methods/configuration/setindexdefinition/"><code>setIndexDefinition</code></a> method in the <a href="/api/indexes/"><code>indexes</code></a> module, for example.</p><a href="/api/common/functions/convenience/defaultsorter/">Read more</a></section><section class="s2" id="/api/common/functions/convenience/getuniqueid/" data-id="gUI"><h2><a href="/api/common/functions/convenience/getuniqueid/"><code>getUniqueId</code></a></h2><p>The <code>getUniqueId</code> function returns a unique string of a given length.</p><a href="/api/common/functions/convenience/getuniqueid/">Read more</a></section></section>
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
<nav><ul><li><a href="/">TinyBase</a></li><li><a href="/api/">API</a></li><li><a href="/api/common/"><code>common</code></a></li><li><a href="/api/common/functions/">Functions</a></li><li><a href="/api/common/functions/convenience/getuniqueid/"><code>getUniqueId</code></a></li></ul></nav><section class="s1" id="/api/common/functions/convenience/getuniqueid/" data-id="gUI"><h1><code>getUniqueId</code></h1><p>The <code>getUniqueId</code> function.</p><pre><code><span class="function"><a href="/api/common/functions/convenience/getuniqueid/">getUniqueId</a></span><span class="punctuation">(</span><span class="punctuation">)</span><span class="operator">:</span> <span class="type"><a href="/api/common/type-aliases/identity/id/">Id</a></span></code></pre><div class="table"><table><tr><th class="right">returns</th><td><code><span class="type"><a href="/api/common/type-aliases/identity/id/">Id</a></span></code></td><td><p></p></td></tr></table></div><section class="s2"><h2>Since</h2><p>v5.0.0</p></section></section>
1+
<nav><ul><li><a href="/">TinyBase</a></li><li><a href="/api/">API</a></li><li><a href="/api/common/"><code>common</code></a></li><li><a href="/api/common/functions/">Functions</a></li><li><a href="/api/common/functions/convenience/getuniqueid/"><code>getUniqueId</code></a></li></ul></nav><section class="s1" id="/api/common/functions/convenience/getuniqueid/" data-id="gUI"><h1><code>getUniqueId</code></h1><p>The <code>getUniqueId</code> function returns a unique string of a given length.</p><pre><code><span class="function"><a href="/api/common/functions/convenience/getuniqueid/">getUniqueId</a></span><span class="punctuation">(</span>length<span class="operator">?</span><span class="operator">:</span> <span class="builtin">number</span><span class="punctuation">)</span><span class="operator">:</span> <span class="type"><a href="/api/common/type-aliases/identity/id/">Id</a></span></code></pre><div class="table"><table><tr><th></th><th>Type</th><th>Description</th></tr><tr><th><code>length<span class="operator">?</span></code></th><td><code><span class="builtin">number</span></code></td><td><p>The desired length of the unique <a href="/api/common/type-aliases/identity/id/"><code>Id</code></a>, defaulting to 16.</p></td></tr><tr><th class="right">returns</th><td><code><span class="type"><a href="/api/common/type-aliases/identity/id/">Id</a></span></code></td><td><p></p><p>A unique <a href="/api/common/type-aliases/identity/id/"><code>Id</code></a> of the required length.</p><p></p></td></tr></table></div><p>This is used internally by <a href="/">TinyBase</a> for the synchronizer protocol and for unique <a href="/api/mergeable-store/interfaces/mergeable/mergeablestore/"><code>MergeableStore</code></a> identifiers. But it is useful enough for it to be publicly exposed for purposes such as identifying shared collaboration rooms, or creating other <a href="/api/common/type-aliases/identity/ids/"><code>Ids</code></a> that need to be unique.</p><p>The string may contain numbers, lower or upper case letters, or the &#x27;-&#x27; or &#x27;_&#x27; characters. This makes them URL-safe, and means they can be identified with a regex like <code>/[-_0-9A-Za-z]+/</code>.</p><p>This function prefers to use the <code>crypto</code> module to generate random numbers, but where that is not available (such as in React Native), a <code>Math.random</code> implementation is used. Whilst that may not be cryptographically sound, it should suffice for most <a href="/">TinyBase</a>-related purposes.</p><section class="s2"><h2>Example</h2><p>This example creates two 8 character long <a href="/api/common/type-aliases/identity/ids/"><code>Ids</code></a> and compares them.</p><pre><code><span class="keyword">import</span> <span class="punctuation">{</span>getUniqueId<span class="punctuation">}</span> <span class="keyword">from</span> <span class="string">'tinybase'</span><span class="punctuation">;</span>
2+
3+
<span class="keyword">const</span> id1 <span class="operator">=</span> <span class="function"><a href="/api/common/functions/convenience/getuniqueid/">getUniqueId</a></span><span class="punctuation">(</span><span class="number">8</span><span class="punctuation">)</span><span class="punctuation">;</span>
4+
<span class="keyword">const</span> id2 <span class="operator">=</span> <span class="function"><a href="/api/common/functions/convenience/getuniqueid/">getUniqueId</a></span><span class="punctuation">(</span><span class="number">8</span><span class="punctuation">)</span><span class="punctuation">;</span>
5+
6+
console<span class="punctuation">.</span><span class="function">log</span><span class="punctuation">(</span>id1<span class="punctuation">.</span>length<span class="punctuation">)</span><span class="punctuation">;</span>
7+
<span class="comment">// -> 8</span>
8+
console<span class="punctuation">.</span><span class="function">log</span><span class="punctuation">(</span>id2<span class="punctuation">.</span>length<span class="punctuation">)</span><span class="punctuation">;</span>
9+
<span class="comment">// -> 8</span>
10+
console<span class="punctuation">.</span><span class="function">log</span><span class="punctuation">(</span>id1 <span class="operator">==</span> id2<span class="punctuation">)</span><span class="punctuation">;</span>
11+
<span class="comment">// -> false</span>
12+
</code></pre></section><section class="s2"><h2>Since</h2><p>v5.0.0</p></section></section>

0 commit comments

Comments
 (0)