Skip to content

Commit

Permalink
Remove DeepReadonly and NumericDictionary types
Browse files Browse the repository at this point in the history
DeepReadonly provides weak control over property and messes up integration
between functions. E.g. when you call update({x: any[]}, ['x'], (arr) => map(arr, ...))
if 'arr' is readonly, it can't be passed as array into map, but can be passed into
numeric dictionary (because TS use structural comparison, forgetting about modifiers).
Numeric dictionary is removed, because I don't believe there are good use cases for it.
  • Loading branch information
Siegrift committed Jul 13, 2019
1 parent d33000b commit 36d051b
Show file tree
Hide file tree
Showing 14 changed files with 516 additions and 921 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ original entity, for example, by using `map` helper this way:

```javascript
const original = [{ a: 0 }, { a: 1 }, { a: 2 }];
const mapped = map(original, (val: any) => (val.a = 3));
const mapped = map(original, (val) => (val.a = 3));
// 'mapped' will equal to [3, 3, 3]
// 'original' will equal to [{ a: 3 }, { a: 3 }, { a: 3 }]
```
Expand Down
753 changes: 95 additions & 658 deletions docs/globals.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h2 id="immutability">Immutability</h2>
according to their idiomatic usage, library is immutable. However, you are able to modify the
original entity, for example, by using <code>map</code> helper this way:</p>
<pre><code class="language-javascript"><span class="hljs-keyword">const</span> original = [{ <span class="hljs-attr">a</span>: <span class="hljs-number">0</span> }, { <span class="hljs-attr">a</span>: <span class="hljs-number">1</span> }, { <span class="hljs-attr">a</span>: <span class="hljs-number">2</span> }];
<span class="hljs-keyword">const</span> mapped = map(original, (val: any) =&gt; (val.a = <span class="hljs-number">3</span>));
<span class="hljs-keyword">const</span> mapped = map(original, (val) =&gt; (val.a = <span class="hljs-number">3</span>));
<span class="hljs-comment">// 'mapped' will equal to [3, 3, 3]</span>
<span class="hljs-comment">// 'original' will equal to [{ a: 3 }, { a: 3 }, { a: 3 }]</span></code></pre>
<h2 id="api-and-documentation">API and documentation</h2>
Expand Down Expand Up @@ -165,11 +165,11 @@ <h2 id="contribution">Contribution</h2>
<li class=" tsd-kind-interface tsd-has-type-parameter">
<a href="interfaces/dictionary.html" class="tsd-kind-icon">Dictionary</a>
</li>
<li class=" tsd-kind-interface tsd-has-type-parameter">
<a href="interfaces/numericdictionary.html" class="tsd-kind-icon">Numeric<wbr>Dictionary</a>
<li class=" tsd-kind-interface tsd-is-not-exported">
<a href="interfaces/state.html" class="tsd-kind-icon">State</a>
</li>
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
<a href="globals.html#deepreadonly" class="tsd-kind-icon">Deep<wbr>Readonly</a>
<li class=" tsd-kind-interface tsd-is-not-exported">
<a href="interfaces/user.html" class="tsd-kind-icon">User</a>
</li>
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
<a href="globals.html#nullable" class="tsd-kind-icon">Nullable</a>
Expand Down
8 changes: 4 additions & 4 deletions docs/interfaces/dictionary.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ <h3 class="tsd-before-signature">Indexable</h3>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-interface tsd-has-type-parameter">
<a href="numericdictionary.html" class="tsd-kind-icon">Numeric<wbr>Dictionary</a>
<li class=" tsd-kind-interface tsd-is-not-exported">
<a href="state.html" class="tsd-kind-icon">State</a>
</li>
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
<a href="../globals.html#deepreadonly" class="tsd-kind-icon">Deep<wbr>Readonly</a>
<li class=" tsd-kind-interface tsd-is-not-exported">
<a href="user.html" class="tsd-kind-icon">User</a>
</li>
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
<a href="../globals.html#nullable" class="tsd-kind-icon">Nullable</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>NumericDictionary | @siegrift/tsfunct</title>
<title>State | @siegrift/tsfunct</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
Expand Down Expand Up @@ -56,35 +56,49 @@
<a href="../globals.html">Globals</a>
</li>
<li>
<a href="numericdictionary.html">NumericDictionary</a>
<a href="state.html">State</a>
</li>
</ul>
<h1>Interface NumericDictionary&lt;T&gt;</h1>
<h1>Interface State</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-type-parameters">
<h3>Type parameters</h3>
<ul class="tsd-type-parameters">
<li>
<h4>T</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">NumericDictionary</span>
<span class="target">State</span>
</li>
</ul>
</section>
<section class="tsd-panel tsd-kind-interface tsd-has-type-parameter">
<h3 class="tsd-before-signature">Indexable</h3>
<div class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">[</span>index: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]: </span><span class="tsd-signature-type">T</span></div>
<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 tsd-is-not-exported">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-interface tsd-is-not-exported"><a href="state.html#users" class="tsd-kind-icon">users</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-not-exported">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface tsd-is-not-exported">
<a name="users" class="tsd-anchor"></a>
<h3>users</h3>
<div class="tsd-signature tsd-kind-icon">users<span class="tsd-signature-symbol">:</span> <a href="user.html" class="tsd-signature-type">User</a><span class="tsd-signature-symbol">[]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in integration.test.ts:11</li>
</ul>
</aside>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
Expand All @@ -102,13 +116,18 @@ <h3 class="tsd-before-signature">Indexable</h3>
</li>
</ul>
<ul class="current">
<li class="current tsd-kind-interface tsd-has-type-parameter">
<a href="numericdictionary.html" class="tsd-kind-icon">Numeric<wbr>Dictionary</a>
<li class="current tsd-kind-interface tsd-is-not-exported">
<a href="state.html" class="tsd-kind-icon">State</a>
<ul>
<li class=" tsd-kind-property tsd-parent-kind-interface tsd-is-not-exported">
<a href="state.html#users" class="tsd-kind-icon">users</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
<a href="../globals.html#deepreadonly" class="tsd-kind-icon">Deep<wbr>Readonly</a>
<li class=" tsd-kind-interface tsd-is-not-exported">
<a href="user.html" class="tsd-kind-icon">User</a>
</li>
<li class=" tsd-kind-type-alias tsd-has-type-parameter">
<a href="../globals.html#nullable" class="tsd-kind-icon">Nullable</a>
Expand Down
Loading

0 comments on commit 36d051b

Please sign in to comment.