Skip to content

Commit

Permalink
Merge pull request #8 from MatrixAI/baseencodingorder
Browse files Browse the repository at this point in the history
Base Encoding Order and Fixing Fixed Point Bug for IdSortable
  • Loading branch information
CMCDragonkai authored Oct 21, 2021
2 parents 4ea34f2 + 30d6f1b commit 99210c9
Show file tree
Hide file tree
Showing 15 changed files with 233 additions and 92 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ console.log(sortId1 < sortId2);
console.log(sortId2 < sortId3);
```

**Base Encoding and Lexicographic Order**

It is important to realise that not all base-encodings preserve lexicographic sort order. The UUID (hex-encoding) and `base58btc` alphabet does, but the `base64` alphabet does not. Make sure to pick an appropriate base encoding if you are expecting to compare the `IdSortable` as base-encoded strings.

## Installation

```sh
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/classes/Id.default.html
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ <h3>[to<wbr>Primitive]</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/Id.ts#L24">src/Id.ts:24</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/Id.ts#L24">src/Id.ts:24</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -1710,7 +1710,7 @@ <h3>to<wbr>String</h3>
<aside class="tsd-sources">
<p>Overrides Uint8Array.toString</p>
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/Id.ts#L28">src/Id.ts:28</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/Id.ts#L28">src/Id.ts:28</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
Expand Down Expand Up @@ -1776,15 +1776,15 @@ <h3><span class="tsd-flag ts-flagStatic">Static</span> create</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/Id.ts#L11">src/Id.ts:11</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/Id.ts#L11">src/Id.ts:11</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a></h4>
</li>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/Id.ts#L12">src/Id.ts:12</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/Id.ts#L12">src/Id.ts:12</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -1798,7 +1798,7 @@ <h4 class="tsd-returns-title">Returns <a href="../modules/Id.html#Id-1" class="t
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/Id.ts#L13">src/Id.ts:13</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/Id.ts#L13">src/Id.ts:13</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -1812,7 +1812,7 @@ <h4 class="tsd-returns-title">Returns <a href="../modules/Id.html#Id-1" class="t
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/Id.ts#L14">src/Id.ts:14</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/Id.ts#L14">src/Id.ts:14</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down
10 changes: 5 additions & 5 deletions docs/classes/IdDeterministic.default.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdDeterministic.ts#L17">src/IdDeterministic.ts:17</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdDeterministic.ts#L17">src/IdDeterministic.ts:17</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -160,7 +160,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> namespace<wbr>Data<
<div class="tsd-signature tsd-kind-icon">namespace<wbr>Data<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Uint8Array</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdDeterministic.ts#L15">src/IdDeterministic.ts:15</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdDeterministic.ts#L15">src/IdDeterministic.ts:15</a></li>
</ul>
</aside>
</section>
Expand All @@ -178,7 +178,7 @@ <h3>[iterator]</h3>
<aside class="tsd-sources">
<p>Implementation of IterableIterator.__@iterator@79</p>
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdDeterministic.ts#L40">src/IdDeterministic.ts:40</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdDeterministic.ts#L40">src/IdDeterministic.ts:40</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">IterableIterator</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -195,7 +195,7 @@ <h3>get</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdDeterministic.ts#L27">src/IdDeterministic.ts:27</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdDeterministic.ts#L27">src/IdDeterministic.ts:27</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -219,7 +219,7 @@ <h3>next</h3>
<aside class="tsd-sources">
<p>Implementation of IterableIterator.next</p>
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdDeterministic.ts#L31">src/IdDeterministic.ts:31</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdDeterministic.ts#L31">src/IdDeterministic.ts:31</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down
12 changes: 6 additions & 6 deletions docs/classes/IdRandom.default.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdRandom.ts#L10">src/IdRandom.ts:10</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdRandom.ts#L10">src/IdRandom.ts:10</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -138,7 +138,7 @@ <h5>random<wbr>Source<span class="tsd-signature-symbol">: </span>function</h5>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdRandom.ts#L13">src/IdRandom.ts:13</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdRandom.ts#L13">src/IdRandom.ts:13</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -167,7 +167,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> random<wbr>Source</
<div class="tsd-signature tsd-kind-icon">random<wbr>Source<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">Uint8Array</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdRandom.ts#L8">src/IdRandom.ts:8</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdRandom.ts#L8">src/IdRandom.ts:8</a></li>
</ul>
</aside>
<div class="tsd-type-declaration">
Expand Down Expand Up @@ -206,7 +206,7 @@ <h3>[iterator]</h3>
<aside class="tsd-sources">
<p>Implementation of IterableIterator.__@iterator@79</p>
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdRandom.ts#L37">src/IdRandom.ts:37</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdRandom.ts#L37">src/IdRandom.ts:37</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">IterableIterator</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -223,7 +223,7 @@ <h3>get</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdRandom.ts#L18">src/IdRandom.ts:18</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdRandom.ts#L18">src/IdRandom.ts:18</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a></h4>
Expand All @@ -241,7 +241,7 @@ <h3>next</h3>
<aside class="tsd-sources">
<p>Implementation of IterableIterator.next</p>
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdRandom.ts#L22">src/IdRandom.ts:22</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdRandom.ts#L22">src/IdRandom.ts:22</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">IteratorResult</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand Down
26 changes: 13 additions & 13 deletions docs/classes/IdSortable.default.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L76">src/IdSortable.ts:76</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L76">src/IdSortable.ts:76</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -167,7 +167,7 @@ <h5>random<wbr>Source<span class="tsd-signature-symbol">: </span>function</h5>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L85">src/IdSortable.ts:85</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L85">src/IdSortable.ts:85</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -189,7 +189,7 @@ <h5>time<wbr>Source<span class="tsd-signature-symbol">: </span>function</h5>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L84">src/IdSortable.ts:84</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L84">src/IdSortable.ts:84</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand Down Expand Up @@ -230,7 +230,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-fl
<div class="tsd-signature tsd-kind-icon">_last<wbr>Id<span class="tsd-signature-symbol">:</span> <a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L73">src/IdSortable.ts:73</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L73">src/IdSortable.ts:73</a></li>
</ul>
</aside>
</section>
Expand All @@ -240,7 +240,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> clock</h3>
<div class="tsd-signature tsd-kind-icon">clock<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L70">src/IdSortable.ts:70</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L70">src/IdSortable.ts:70</a></li>
</ul>
</aside>
<div class="tsd-type-declaration">
Expand All @@ -265,7 +265,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-fl
<div class="tsd-signature tsd-kind-icon">last<wbr>Ts<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><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L72">src/IdSortable.ts:72</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L72">src/IdSortable.ts:72</a></li>
</ul>
</aside>
</section>
Expand All @@ -275,7 +275,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-fl
<div class="tsd-signature tsd-kind-icon">node<wbr>Bits<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L71">src/IdSortable.ts:71</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L71">src/IdSortable.ts:71</a></li>
</ul>
</aside>
</section>
Expand All @@ -285,7 +285,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> random<wbr>Source</
<div class="tsd-signature tsd-kind-icon">random<wbr>Source<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span>size<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol"> =&gt; </span><span class="tsd-signature-type">Uint8Array</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L69">src/IdSortable.ts:69</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L69">src/IdSortable.ts:69</a></li>
</ul>
</aside>
<div class="tsd-type-declaration">
Expand Down Expand Up @@ -316,7 +316,7 @@ <h3><span class="tsd-flag ts-flagProtected">Protected</span> seq<wbr>Counter</h3
<div class="tsd-signature tsd-kind-icon">seq<wbr>Counter<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L74">src/IdSortable.ts:74</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L74">src/IdSortable.ts:74</a></li>
</ul>
</aside>
</section>
Expand All @@ -333,7 +333,7 @@ <h3>last<wbr>Id</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L101">src/IdSortable.ts:101</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L101">src/IdSortable.ts:101</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a></h4>
Expand All @@ -354,7 +354,7 @@ <h3>[iterator]</h3>
<aside class="tsd-sources">
<p>Implementation of IterableIterator.__@iterator@79</p>
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L153">src/IdSortable.ts:153</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L153">src/IdSortable.ts:153</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">IterableIterator</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a><span class="tsd-signature-symbol">&gt;</span></h4>
Expand All @@ -371,7 +371,7 @@ <h3>get</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L108">src/IdSortable.ts:108</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L108">src/IdSortable.ts:108</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a></h4>
Expand All @@ -389,7 +389,7 @@ <h3>next</h3>
<aside class="tsd-sources">
<p>Implementation of IterableIterator.next</p>
<ul>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/3d425fa/src/IdSortable.ts#L112">src/IdSortable.ts:112</a></li>
<li>Defined in <a href="https://github.com/MatrixAI/js-id/blob/216a940/src/IdSortable.ts#L112">src/IdSortable.ts:112</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">IteratorResult</span><span class="tsd-signature-symbol">&lt;</span><a href="../modules/Id.html#Id-1" class="tsd-signature-type" data-tsd-kind="Type alias">Id</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
Expand Down
2 changes: 2 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ <h1>js-id</h1>
<span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #001080">sortId1</span><span style="color: #000000"> &lt; </span><span style="color: #001080">sortId2</span><span style="color: #000000">);</span>
<span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #001080">sortId2</span><span style="color: #000000"> &lt; </span><span style="color: #001080">sortId3</span><span style="color: #000000">);</span>
</code></pre>
<p><strong>Base Encoding and Lexicographic Order</strong></p>
<p>It is important to realise that not all base-encodings preserve lexicographic sort order. The UUID (hex-encoding) and <code>base58btc</code> alphabet does, but the <code>base64</code> alphabet does not. Make sure to pick an appropriate base encoding if you are expecting to compare the <code>IdSortable</code> as base-encoded strings.</p>
<a href="#installation" id="installation" style="color: inherit; text-decoration: none;">
<h2>Installation</h2>
</a>
Expand Down
Loading

0 comments on commit 99210c9

Please sign in to comment.