Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeh committed Jul 18, 2020
1 parent 5c04c23 commit 3ebaa26
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/404.html
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="icon" href="/json/favicon.ico"/><title>404 - not found</title><meta name="description" content="404 - not found."/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"404 - not found"}</script><link rel="stylesheet" href="/json/magic.css?/dz1c7J6y4" integrity="sha384-/dz1c7J6y42E0eCzAv8FlX5isd3GiPVlvRYzwxVc31ZmoxOnFREg0knYaEWedM33" crossorigin="anonymous"/></head><body><a class="SkipLink" href="/json/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><div><a class="Logo" href="/json/"><svg viewBox="0 0 512 444"><path d="M512 444L256 0 0 444z" fill="#663695"></path><circle cx="256" cy="294" r="130" fill="#fff"></circle><circle cx="256" cy="281" r="40" fill="#663695"></circle><path d="M256 350v44m24-44l1 13c1 27 29 27 29-7m-160-72s46-47 106-47c59 0 106 47 106 47s-47 43-106 43c-60 0-106-43-106-43zm65-75a134 134 0 0189 2" class="stroke"></path><path d="M256 81v53m184 270l-43-29M72 404l43-29" class="stroke white"></path></svg></a><p>@magic-libraries/json</p><nav class="Menu"><ul><li><a href="/json/#installation">installation</a></li><li><a href="/json/#usage">usage</a></li><li><a href="/json/#caveat">caveat</a></li><li><a href="/json/#source">source</a></li></ul></nav></div></header><div class="Page" id="page"><div>404 - not found.</div></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://magic.github.io/">magic</a></div></div></footer></div></main><script src="/json/magic.js?RAJv6zbfZk" integrity="sha384-RAJv6zbfZkuiU9do4rLWhKXTkld37uTwf8F9mJeHd/BPhMPy7yNt05xMNOTj9K5J" crossorigin="anonymous"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="icon" href="/json/favicon.ico"/><title>404 - not found</title><meta name="description" content="404 - not found."/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"404 - not found"}</script><link rel="stylesheet" href="/json/magic.css?hdOB3ujppK" integrity="sha384-hdOB3ujppK9vk/35z7SqQe9J8B7pQ3tVL4gVjMS7lhQ9PpMpCZLMYjGO6fEbDqSk" crossorigin="anonymous"/></head><body><a class="SkipLink" href="/json/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><div><a class="Logo" href="/json/"><svg viewBox="0 0 512 444"><path d="M512 444L256 0 0 444z" fill="#663695"></path><circle cx="256" cy="294" r="130" fill="#fff"></circle><circle cx="256" cy="281" r="40" fill="#663695"></circle><path d="M256 350v44m24-44l1 13c1 27 29 27 29-7m-160-72s46-47 106-47c59 0 106 47 106 47s-47 43-106 43c-60 0-106-43-106-43zm65-75a134 134 0 0189 2" class="stroke"></path><path d="M256 81v53m184 270l-43-29M72 404l43-29" class="stroke white"></path></svg></a><p>@magic-libraries/json</p><nav class="Menu"><ul><li><a href="/json/#installation">installation</a></li><li><a href="/json/#usage">usage</a></li><li><a href="/json/#caveat">caveat</a></li><li><a href="/json/#source">source</a></li></ul></nav></div></header><div class="Page" id="page"><div>404 - not found.</div></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://magic.github.io/">magic</a></div></div></footer></div></main><script src="/json/magic.js?crQJCS0sbQ" integrity="sha384-crQJCS0sbQaPiUz0W20IIGxjFjob9l+Lr5bQbWPxWNNH0khTDy/USElrP5mkgw99" crossorigin="anonymous"></script></body></html>
4 changes: 2 additions & 2 deletions docs/index.html
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="icon" href="/json/favicon.ico"/><title>@magic-libraries/json</title><meta name="description" content="json client lib for @magic. returns errors instead of throwing them."/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"@magic-libraries/json"}</script><link rel="stylesheet" href="/json/magic.css?/dz1c7J6y4" integrity="sha384-/dz1c7J6y42E0eCzAv8FlX5isd3GiPVlvRYzwxVc31ZmoxOnFREg0knYaEWedM33" crossorigin="anonymous"/></head><body><a class="SkipLink" href="/json/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><div><a class="Logo" href="/json/"><svg viewBox="0 0 512 444"><path d="M512 444L256 0 0 444z" fill="#663695"></path><circle cx="256" cy="294" r="130" fill="#fff"></circle><circle cx="256" cy="281" r="40" fill="#663695"></circle><path d="M256 350v44m24-44l1 13c1 27 29 27 29-7m-160-72s46-47 106-47c59 0 106 47 106 47s-47 43-106 43c-60 0-106-43-106-43zm65-75a134 134 0 0189 2" class="stroke"></path><path d="M256 81v53m184 270l-43-29M72 404l43-29" class="stroke white"></path></svg></a><p>@magic-libraries/json</p><nav class="Menu"><ul><li><a href="/json/#installation">installation</a></li><li><a href="/json/#usage">usage</a></li><li><a href="/json/#caveat">caveat</a></li><li><a href="/json/#source">source</a></li></ul></nav></div></header><div class="Page" id="page"><h1 id="magic-librariesjson">@magic-libraries/json</h1><p>this is the
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><link rel="icon" href="/json/favicon.ico"/><title>@magic-libraries/json</title><meta name="description" content="json client lib for @magic. returns errors instead of throwing them."/><script type="application/ld+json">{"@context":"http://schema.org","@type":"website","name":"@magic-libraries/json"}</script><link rel="stylesheet" href="/json/magic.css?hdOB3ujppK" integrity="sha384-hdOB3ujppK9vk/35z7SqQe9J8B7pQ3tVL4gVjMS7lhQ9PpMpCZLMYjGO6fEbDqSk" crossorigin="anonymous"/></head><body><a class="SkipLink" href="/json/#page">Skip to Content</a><main id="Magic"><div class="Wrapper"><header class="Header"><div><a class="Logo" href="/json/"><svg viewBox="0 0 512 444"><path d="M512 444L256 0 0 444z" fill="#663695"></path><circle cx="256" cy="294" r="130" fill="#fff"></circle><circle cx="256" cy="281" r="40" fill="#663695"></circle><path d="M256 350v44m24-44l1 13c1 27 29 27 29-7m-160-72s46-47 106-47c59 0 106 47 106 47s-47 43-106 43c-60 0-106-43-106-43zm65-75a134 134 0 0189 2" class="stroke"></path><path d="M256 81v53m184 270l-43-29M72 404l43-29" class="stroke white"></path></svg></a><p>@magic-libraries/json</p><nav class="Menu"><ul><li><a href="/json/#installation">installation</a></li><li><a href="/json/#usage">usage</a></li><li><a href="/json/#caveat">caveat</a></li><li><a href="/json/#source">source</a></li></ul></nav></div></header><div class="Page" id="page"><h1 id="magic-librariesjson">@magic-libraries/json</h1><p>this is the
<a href="https://github.com/magic-libraries" target="_blank" rel="noopener">@magic-libraries</a>
json library. it returns errors instead of throwing them
and catches (some) malformed objects when stringifying.</p><ul class="GitBadges"><li><a href="https://www.npmjs.com/package/@magic-libraries/json" target="_blank" rel="noopener"><img src="https://img.shields.io/npm/v/@magic-libraries/json?color=blue" height="23" role="presentation" alt="" loading="lazy"/></a></li><li><img src="https://img.shields.io/node/v/@magic-libraries/json?color=blue" height="23" role="presentation" alt="" loading="lazy"/></li><li><img src="https://img.shields.io/npm/l/@magic-libraries/json?color=blue" height="23" role="presentation" alt="" loading="lazy"/></li><li><a href="https://travis-ci.com/magic-libraries/json" target="_blank" rel="noopener"><img src="https://img.shields.io/travis/com/magic-libraries/json/master" height="23" role="presentation" alt="" loading="lazy"/></a></li><li><a href="https://ci.appveyor.com/project/magiclibraries/json/branch/master" target="_blank" rel="noopener"><img src="https://img.shields.io/appveyor/ci/magiclibraries/json/master.svg" height="23" role="presentation" alt="" loading="lazy"/></a></li><li><a href="https://coveralls.io/github/magic-libraries/json" target="_blank" rel="noopener"><img src="https://img.shields.io/coveralls/github/magic-libraries/json/master.svg" height="23" role="presentation" alt="" loading="lazy"/></a></li><li><a href="https://snyk.io/test/github/magic-libraries/json" target="_blank" rel="noopener"><img src="https://img.shields.io/snyk/vulnerabilities/github/magic-libraries/json.svg" height="23" role="presentation" alt="" loading="lazy"/></a></li></ul><h3 id="installation">installation</h3><div class="Pre"><div class="menu"><button>copy</button></div><pre><code class="line"><span class="keyword">npm</span> <span class="keyword">install</span> @magic-libraries/json</code></pre></div><h3 id="usage">usage</h3><p>in a page/component, just use the lib.json functions</p><div class="Pre"><div class="menu"><button>copy</button></div><pre><code class="line">lib.json.stringify({ some: { object: [<span class="string">&#39;with&#39;</span>, <span class="string">&#39;values&#39;</span>] } })</code></pre></div><p>renders</p><div class="Pre"><div class="menu"><button>copy</button></div><pre><code class="line">{ <span class="string">&quot;some&quot;</span>: { <span class="string">&quot;object&quot;</span>: [<span class="string">&quot;with&quot;</span>, <span class="string">&quot;values&quot;</span>] } }</code></pre></div><h3 id="caveat">caveat</h3><p>this library is intended to handle incoming web traffic.
Expand All @@ -7,4 +7,4 @@
(and enhanced with custom error messages).</p><div class="Pre lines"><div class="menu"><button>copy</button></div><pre><code class="line"><span class="keyword">export</span> <span class="keyword">const</span> ViewStringify = unsafe <span class="keyword">=&gt;</span> {</code><code class="line"> <span class="keyword">const</span> result = lib.json.stringify(unsafe)</code><code class="line"> <span class="keyword">return</span> div([result.message ? result.message : result])</code><code class="line">}</code><code class="line"></code><code class="line"><span class="keyword">export</span> <span class="keyword">const</span> ViewParse = unsafe <span class="keyword">=&gt;</span> {</code><code class="line"> <span class="keyword">const</span> result = lib.json.parse(unsafe)</code><code class="line"> <span class="comment">// <span class="keyword">in</span> <span class="keyword">this</span> <span class="keyword">case</span> we can not check <span class="keyword">for</span> .message,</span></code><code class="line"> <span class="comment">// since unsafe might have a .message key after parsing</span></code><code class="line"> div([result <span class="keyword">instanceof</span> Error ? result.message : result])</code><code class="line">}</code></pre></div><h3 id="example-modules">example modules</h3><p>the example/assets directory contains two modules that use the lib.json functions:</p><div class="Pre"><div class="menu"><button>copy</button></div><pre><code class="line">&lt;JsonStringify state&gt;&lt;/JsonStringify&gt;</code></pre></div><p>renders</p><div class="Pre lines"><div class="menu"><button>copy</button></div><pre><code class="line">stringified JSON:</code><code class="line"></code><code class="line">{</code><code class="line"> <span class="string">&quot;state&quot;</span>: {</code><code class="line"> <span class="string">&quot;title&quot;</span>: <span class="string">&quot;@magic-libraries/json&quot;</span>,</code><code class="line"> <span class="string">&quot;description&quot;</span>: <span class="string">&quot;json client lib for @magic. returns errors instead of throwing them.&quot;</span>,</code><code class="line"> <span class="string">&quot;logotext&quot;</span>: <span class="string">&quot;@magic-libraries/json&quot;</span>,</code><code class="line"> <span class="string">&quot;menu&quot;</span>: [</code><code class="line"> {</code><code class="line"> <span class="string">&quot;to&quot;</span>: <span class="string">&quot;/#installation&quot;</span>,</code><code class="line"> <span class="string">&quot;text&quot;</span>: <span class="string">&quot;installation&quot;</span></code><code class="line"> },</code><code class="line"> {</code><code class="line"> <span class="string">&quot;to&quot;</span>: <span class="string">&quot;/#usage&quot;</span>,</code><code class="line"> <span class="string">&quot;text&quot;</span>: <span class="string">&quot;usage&quot;</span></code><code class="line"> },</code><code class="line"> {</code><code class="line"> <span class="string">&quot;to&quot;</span>: <span class="string">&quot;/#caveat&quot;</span>,</code><code class="line"> <span class="string">&quot;text&quot;</span>: <span class="string">&quot;caveat&quot;</span></code><code class="line"> },</code><code class="line"> {</code><code class="line"> <span class="string">&quot;to&quot;</span>: <span class="string">&quot;/#source&quot;</span>,</code><code class="line"> <span class="string">&quot;text&quot;</span>: <span class="string">&quot;source&quot;</span></code><code class="line"> }</code><code class="line"> ],</code><code class="line"> <span class="string">&quot;nospy&quot;</span>: {</code><code class="line"> <span class="string">&quot;show&quot;</span>: <span class="boolean">false</span></code><code class="line"> },</code><code class="line"> <span class="string">&quot;theme&quot;</span>: <span class="string">&quot;dark&quot;</span>,</code><code class="line"> <span class="string">&quot;pageClass&quot;</span>: {},</code><code class="line"> <span class="string">&quot;url&quot;</span>: <span class="string">&quot;/json/&quot;</span>,</code><code class="line"> <span class="string">&quot;root&quot;</span>: <span class="string">&quot;/json/&quot;</span>,</code><code class="line"> <span class="string">&quot;pages&quot;</span>: {</code><code class="line"> <span class="string">&quot;/json/&quot;</span>: {</code><code class="line"> <span class="string">&quot;title&quot;</span>: <span class="string">&quot;@magic-libraries/json&quot;</span>,</code><code class="line"> <span class="string">&quot;description&quot;</span>: <span class="string">&quot;json client lib for @magic. returns errors instead of throwing them.&quot;</span>,</code><code class="line"> <span class="string">&quot;logotext&quot;</span>: <span class="string">&quot;@magic-libraries/json&quot;</span>,</code><code class="line"> <span class="string">&quot;menu&quot;</span>: [</code><code class="line"> {</code><code class="line"> <span class="string">&quot;to&quot;</span>: <span class="string">&quot;/#installation&quot;</span>,</code><code class="line"> <span class="string">&quot;text&quot;</span>: <span class="string">&quot;installation&quot;</span></code><code class="line"> },</code><code class="line"> {</code><code class="line"> <span class="string">&quot;to&quot;</span>: <span class="string">&quot;/#usage&quot;</span>,</code><code class="line"> <span class="string">&quot;text&quot;</span>: <span class="string">&quot;usage&quot;</span></code><code class="line"> },</code><code class="line"> {</code><code class="line"> <span class="string">&quot;to&quot;</span>: <span class="string">&quot;/#caveat&quot;</span>,</code><code class="line"> <span class="string">&quot;text&quot;</span>: <span class="string">&quot;caveat&quot;</span></code><code class="line"> },</code><code class="line"> {</code><code class="line"> <span class="string">&quot;to&quot;</span>: <span class="string">&quot;/#source&quot;</span>,</code><code class="line"> <span class="string">&quot;text&quot;</span>: <span class="string">&quot;source&quot;</span></code><code class="line"> }</code><code class="line"> ],</code><code class="line"> <span class="string">&quot;url&quot;</span>: <span class="string">&quot;/json/&quot;</span>,</code><code class="line"> <span class="string">&quot;root&quot;</span>: <span class="string">&quot;/json/&quot;</span></code><code class="line"> },</code><code class="line"> <span class="string">&quot;/json/404/&quot;</span>: {</code><code class="line"> <span class="string">&quot;title&quot;</span>: <span class="string">&quot;404 - not found&quot;</span>,</code><code class="line"> <span class="string">&quot;description&quot;</span>: <span class="string">&quot;404 - not found.&quot;</span></code><code class="line"> }</code><code class="line"> }</code><code class="line"> }</code><code class="line">}</code></pre></div><div class="Pre"><div class="menu"><button>copy</button></div><pre><code class="line">&lt;JsonParse&gt;{ <span class="string">&quot;valid&quot;</span>: <span class="boolean">true</span> }&lt;/JsonParse&gt;</code></pre></div><p>renders</p><div class="Pre lines"><div class="menu"><button>copy</button></div><pre><code class="line">parsed (and then stringified) JSON:</code><code class="line"></code><code class="line">{</code><code class="line"> <span class="string">&quot;valid&quot;</span>: <span class="boolean">true</span></code><code class="line">}</code></pre></div><h3 id="source">source</h3><p>the source for this page is in the
<a href="https://github.com/magic-libraries/json/tree/master/example" target="_blank" rel="noopener">example directory</a>
and gets built and published to github using
<a href="https://github.com/magic/core" target="_blank" rel="noopener">@magic/core</a></p></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://magic.github.io/">magic</a></div></div></footer></div></main><script src="/json/magic.js?RAJv6zbfZk" integrity="sha384-RAJv6zbfZkuiU9do4rLWhKXTkld37uTwf8F9mJeHd/BPhMPy7yNt05xMNOTj9K5J" crossorigin="anonymous"></script></body></html>
<a href="https://github.com/magic/core" target="_blank" rel="noopener">@magic/core</a></p></div><footer class="Footer"><div class="Container"><div class="Credits">made with a few bits of <a target="_blank" rel="noopener" href="https://magic.github.io/">magic</a></div></div></footer></div></main><script src="/json/magic.js?crQJCS0sbQ" integrity="sha384-crQJCS0sbQaPiUz0W20IIGxjFjob9l+Lr5bQbWPxWNNH0khTDy/USElrP5mkgw99" crossorigin="anonymous"></script></body></html>

0 comments on commit 3ebaa26

Please sign in to comment.