Permalink
Browse files

Created gh-pages branch via GitHub

  • Loading branch information...
0 parents commit c786573a31ba4161ba8571134b0bc3092d333a40 @andreyvit committed Apr 17, 2012
Showing with 571 additions and 0 deletions.
  1. BIN images/checker.png
  2. +127 −0 index.html
  3. +20 −0 javascripts/scale.fix.js
  4. +1 −0 params.json
  5. +60 −0 stylesheets/pygment_trac.css
  6. +363 −0 stylesheets/styles.css
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,127 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <title>json-diff by andreyvit</title>
+
+ <link rel="stylesheet" href="stylesheets/styles.css">
+ <link rel="stylesheet" href="stylesheets/pygment_trac.css">
+ <script src="javascripts/scale.fix.js"></script>
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+ <!--[if lt IE 9]>
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ </head>
+ <body>
+ <div class="wrapper">
+ <header>
+ <h1>json-diff</h1>
+<p>Structural diff for JSON files</p>
+ <p class="view"><a href="https://github.com/andreyvit/json-diff">View the Project on GitHub <small>andreyvit/json-diff</small></a></p>
+ <ul>
+ <li><a href="https://github.com/andreyvit/json-diff/zipball/master">Download <strong>ZIP File</strong></a></li>
+ <li><a href="https://github.com/andreyvit/json-diff/tarball/master">Download <strong>TAR Ball</strong></a></li>
+ <li><a href="https://github.com/andreyvit/json-diff">View On <strong>GitHub</strong></a></li>
+ </ul>
+ </header>
+ <section>
+ <h1>JSON structural diff</h1>
+
+<p>Does exactly what you think it does:</p>
+
+<p><img src="https://github.com/andreyvit/json-diff/raw/master/doc/screenshot.png" alt="Screenshot"></p>
+
+<h2>Installation</h2>
+
+<pre><code>npm install json-diff
+</code></pre>
+
+<h2>Usage</h2>
+
+<p>Simple:</p>
+
+<pre><code>json-diff a.json b.json
+</code></pre>
+
+<p>Detailed:</p>
+
+<pre><code>% json-diff --help
+Usage: json-diff [-vjC] first.json second.json
+
+Arguments:
+ first.json Old file
+ second.json New file
+
+General options:
+ -v, --verbose Output progress info
+ -C, --[no-]color Colored output
+ -j, --raw-json Display raw JSON encoding of the diff
+ -h, --help Display this usage information
+</code></pre>
+
+<h2>Features</h2>
+
+<ul>
+<li>colorized, diff-like output</li>
+<li>fuzzy matching of modified array elements (when array elements are object hierarchies)</li>
+<li>reasonable test coverage (far from 100%, though)</li>
+</ul><h2>Tests</h2>
+
+<p>Run:</p>
+
+<pre><code>`npm test`
+</code></pre>
+
+<p>Output:</p>
+
+<pre><code>colorize
+ ✓ should return ' &lt;value&gt;' for a scalar value
+ ✓ should return '-&lt;old value&gt;', '+&lt;new value&gt;' for a scalar diff
+ ✓ should return '-&lt;removed key&gt;: &lt;removed value&gt;' for an object diff with a removed key
+ ✓ should return '+&lt;added key&gt;: &lt;added value&gt;' for an object diff with an added key
+ ✓ should return '+&lt;added key&gt;: &lt;added stringified value&gt;' for an object diff with an added key and a non-scalar value
+ ✓ should return ' &lt;modified key&gt;: &lt;colorized diff&gt;' for an object diff with a modified key
+ ✓ should return '+&lt;inserted item&gt;' for an array diff
+ ✓ should return '-&lt;deleted item&gt;' for an array diff
+
+diff
+ with simple scalar values
+ ✓ should return undefined for two identical numbers
+ ✓ should return undefined for two identical strings
+ ✓ should return { __old: &lt;old value&gt;, __new: &lt;new value&gt; } object for two different numbers
+ with objects
+ ✓ should return undefined for two objects with identical contents
+ ✓ should return undefined for two object hierarchies with identical contents
+ ✓ should return { &lt;key&gt;__deleted: &lt;old value&gt; } when the second object is missing a key
+ ✓ should return { &lt;key&gt;__added: &lt;new value&gt; } when the first object is missing a key
+ ✓ should return { &lt;key&gt;: { __old: &lt;old value&gt;, __new: &lt;new value&gt; } } for two objects with diffent scalar values for a key
+ ✓ should return { &lt;key&gt;: &lt;diff&gt; } with a recursive diff for two objects with diffent values for a key
+ with arrays of scalars
+ ✓ should return undefined for two arrays with identical contents
+ ✓ should return [..., ['-', &lt;removed item&gt;], ...] for two arrays when the second array is missing a value
+ ✓ should return [..., ['+', &lt;added item&gt;], ...] for two arrays when the second one has an extra value
+ ✓ should return [..., ['+', &lt;added item&gt;]] for two arrays when the second one has an extra value at the end (edge case test)
+ with arrays of objects
+ ✓ should return undefined for two arrays with identical contents
+ ✓ should return [..., ['-', &lt;removed item&gt;], ...] for two arrays when the second array is missing a value
+ ✓ should return [..., ['+', &lt;added item&gt;], ...] for two arrays when the second array has an extra value
+ ✓ should return [..., ['~', &lt;diff&gt;], ...] for two arrays when an item has been modified (note: involves a crazy heuristic)
+
+✔ 25 tests complete (12ms)
+</code></pre>
+
+<h2>License</h2>
+
+<p>© Andrey Tarantsov. Distributed under the MIT license.</p>
+ </section>
+ </div>
+ <footer>
+ <p>Project maintained by <a href="https://github.com/andreyvit">andreyvit</a></p>
+ <p>Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></p>
+ </footer>
+ <!--[if !IE]><script>fixScale(document);</script><!--<![endif]-->
+
+ </body>
+</html>
@@ -0,0 +1,20 @@
+fixScale = function(doc) {
+
+ var addEvent = 'addEventListener',
+ type = 'gesturestart',
+ qsa = 'querySelectorAll',
+ scales = [1, 1],
+ meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
+
+ function fix() {
+ meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
+ doc.removeEventListener(type, fix, true);
+ }
+
+ if ((meta = meta[meta.length - 1]) && addEvent in doc) {
+ fix();
+ scales = [.25, 1.6];
+ doc[addEvent](type, fix, true);
+ }
+
+};
@@ -0,0 +1 @@
+{"name":"json-diff","body":"JSON structural diff\r\n====================\r\n\r\nDoes exactly what you think it does:\r\n\r\n![Screenshot](https://github.com/andreyvit/json-diff/raw/master/doc/screenshot.png)\r\n\r\n\r\nInstallation\r\n------------\r\n\r\n npm install json-diff\r\n\r\n\r\nUsage\r\n-----\r\n\r\nSimple:\r\n\r\n json-diff a.json b.json\r\n\r\nDetailed:\r\n\r\n % json-diff --help\r\n Usage: json-diff [-vjC] first.json second.json\r\n\r\n Arguments:\r\n first.json Old file\r\n second.json New file\r\n\r\n General options:\r\n -v, --verbose Output progress info\r\n -C, --[no-]color Colored output\r\n -j, --raw-json Display raw JSON encoding of the diff\r\n -h, --help Display this usage information\r\n\r\n\r\nFeatures\r\n--------\r\n\r\n* colorized, diff-like output\r\n* fuzzy matching of modified array elements (when array elements are object hierarchies)\r\n* reasonable test coverage (far from 100%, though)\r\n\r\n\r\nTests\r\n-----\r\n\r\nRun:\r\n\r\n `npm test`\r\n\r\nOutput:\r\n\r\n colorize\r\n ✓ should return ' <value>' for a scalar value\r\n ✓ should return '-<old value>', '+<new value>' for a scalar diff\r\n ✓ should return '-<removed key>: <removed value>' for an object diff with a removed key\r\n ✓ should return '+<added key>: <added value>' for an object diff with an added key\r\n ✓ should return '+<added key>: <added stringified value>' for an object diff with an added key and a non-scalar value\r\n ✓ should return ' <modified key>: <colorized diff>' for an object diff with a modified key\r\n ✓ should return '+<inserted item>' for an array diff\r\n ✓ should return '-<deleted item>' for an array diff\r\n\r\n diff\r\n with simple scalar values\r\n ✓ should return undefined for two identical numbers\r\n ✓ should return undefined for two identical strings\r\n ✓ should return { __old: <old value>, __new: <new value> } object for two different numbers\r\n with objects\r\n ✓ should return undefined for two objects with identical contents\r\n ✓ should return undefined for two object hierarchies with identical contents\r\n ✓ should return { <key>__deleted: <old value> } when the second object is missing a key\r\n ✓ should return { <key>__added: <new value> } when the first object is missing a key\r\n ✓ should return { <key>: { __old: <old value>, __new: <new value> } } for two objects with diffent scalar values for a key\r\n ✓ should return { <key>: <diff> } with a recursive diff for two objects with diffent values for a key\r\n with arrays of scalars\r\n ✓ should return undefined for two arrays with identical contents\r\n ✓ should return [..., ['-', <removed item>], ...] for two arrays when the second array is missing a value\r\n ✓ should return [..., ['+', <added item>], ...] for two arrays when the second one has an extra value\r\n ✓ should return [..., ['+', <added item>]] for two arrays when the second one has an extra value at the end (edge case test)\r\n with arrays of objects\r\n ✓ should return undefined for two arrays with identical contents\r\n ✓ should return [..., ['-', <removed item>], ...] for two arrays when the second array is missing a value\r\n ✓ should return [..., ['+', <added item>], ...] for two arrays when the second array has an extra value\r\n ✓ should return [..., ['~', <diff>], ...] for two arrays when an item has been modified (note: involves a crazy heuristic)\r\n\r\n ✔ 25 tests complete (12ms)\r\n\r\n\r\nLicense\r\n-------\r\n\r\n© Andrey Tarantsov. Distributed under the MIT license.\r\n","tagline":"Structural diff for JSON files","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
@@ -0,0 +1,60 @@
+.highlight .hll { background-color: #49483e }
+.highlight { background: #3A3C42; color: #f8f8f2 }
+.highlight .c { color: #75715e } /* Comment */
+.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
+.highlight .k { color: #66d9ef } /* Keyword */
+.highlight .l { color: #ae81ff } /* Literal */
+.highlight .n { color: #f8f8f2 } /* Name */
+.highlight .o { color: #f92672 } /* Operator */
+.highlight .p { color: #f8f8f2 } /* Punctuation */
+.highlight .cm { color: #75715e } /* Comment.Multiline */
+.highlight .cp { color: #75715e } /* Comment.Preproc */
+.highlight .c1 { color: #75715e } /* Comment.Single */
+.highlight .cs { color: #75715e } /* Comment.Special */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .kc { color: #66d9ef } /* Keyword.Constant */
+.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
+.highlight .kn { color: #f92672 } /* Keyword.Namespace */
+.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
+.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
+.highlight .kt { color: #66d9ef } /* Keyword.Type */
+.highlight .ld { color: #e6db74 } /* Literal.Date */
+.highlight .m { color: #ae81ff } /* Literal.Number */
+.highlight .s { color: #e6db74 } /* Literal.String */
+.highlight .na { color: #a6e22e } /* Name.Attribute */
+.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
+.highlight .nc { color: #a6e22e } /* Name.Class */
+.highlight .no { color: #66d9ef } /* Name.Constant */
+.highlight .nd { color: #a6e22e } /* Name.Decorator */
+.highlight .ni { color: #f8f8f2 } /* Name.Entity */
+.highlight .ne { color: #a6e22e } /* Name.Exception */
+.highlight .nf { color: #a6e22e } /* Name.Function */
+.highlight .nl { color: #f8f8f2 } /* Name.Label */
+.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
+.highlight .nx { color: #a6e22e } /* Name.Other */
+.highlight .py { color: #f8f8f2 } /* Name.Property */
+.highlight .nt { color: #f92672 } /* Name.Tag */
+.highlight .nv { color: #f8f8f2 } /* Name.Variable */
+.highlight .ow { color: #f92672 } /* Operator.Word */
+.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
+.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
+.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
+.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
+.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
+.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
+.highlight .sc { color: #e6db74 } /* Literal.String.Char */
+.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
+.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
+.highlight .se { color: #ae81ff } /* Literal.String.Escape */
+.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
+.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
+.highlight .sx { color: #e6db74 } /* Literal.String.Other */
+.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
+.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
+.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
+.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
+.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
+.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
+.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
Oops, something went wrong.

0 comments on commit c786573

Please sign in to comment.