| 1 |
<section class="suite"> |
| 2 |
<h1>JSON.minify</h1> |
| 3 |
<dl> |
| 4 |
<dt>define</dt> |
| 5 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 6 |
<dd><pre><code>JSON.minify.should.be.ok;</code></pre></dd> |
| 7 |
<dt>in-memory string</dt> |
| 8 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 9 |
<dd><pre><code>var json = '{"key":"value"}'; |
| 10 |
var res = JSON.minify(json); |
| 11 |
JSON.parse(res).key.should.equal('value');</code></pre></dd> |
| 12 |
<dt>comment.json</dt> |
| 13 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 14 |
<dd><pre><code>var json = fs.readFileSync(__dirname + '/comment.json', 'utf8'); |
| 15 |
var res = JSON.parse(JSON.minify(json)); |
| 16 |
res.foo.should.equal('bar');</code></pre></dd> |
| 17 |
<dt>comment.json</dt> |
| 18 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 19 |
<dd><pre><code>var json = fs.readFileSync(__dirname + '/plain.json', 'utf8'); |
| 20 |
var res = JSON.parse(JSON.minify(json)); |
| 21 |
res.foo.should.equal('bar');</code></pre></dd> |
| 22 |
<dt>in-memory string json.array plain</dt> |
| 23 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 24 |
<dd><pre><code>var json = '[1,2,3]'; |
| 25 |
var res = JSON.parse(JSON.minify(json)); |
| 26 |
res.length.should.equal(3);</code></pre></dd> |
| 27 |
<dt>in-memory string json.array start line comment</dt> |
| 28 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 29 |
<dd><pre><code>var json = '//[1,2,3]\n[4,5,6,7]'; |
| 30 |
var res = JSON.parse(JSON.minify(json)); |
| 31 |
res.length.should.equal(4); |
| 32 |
should(res[0]).be.exactly(4).and.be.a.Number();</code></pre></dd> |
| 33 |
<dt>in-memory string json.array start multi comment</dt> |
| 34 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 35 |
<dd><pre><code>var json = '/**[1,2,3]*/[8,9,10,11]'; |
| 36 |
var res = JSON.parse(JSON.minify(json)); |
| 37 |
res.length.should.equal(4); |
| 38 |
should(res[0]).be.exactly(8).and.be.a.Number();</code></pre></dd> |
| 39 |
<dt>in-memory string json.array end line comment</dt> |
| 40 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 41 |
<dd><pre><code>var json = '[4,5,6,7]//[1,2,3]'; |
| 42 |
var res = JSON.parse(JSON.minify(json)); |
| 43 |
res.length.should.equal(4); |
| 44 |
should(res[0]).be.exactly(4).and.be.a.Number();</code></pre></dd> |
| 45 |
<dt>in-memory string json.array end multi comment</dt> |
| 46 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 47 |
<dd><pre><code>var json = '[8,9,10,11]/**[1,2,3]*/'; |
| 48 |
var res = JSON.parse(JSON.minify(json)); |
| 49 |
res.length.should.equal(4); |
| 50 |
should(res[0]).be.exactly(8).and.be.a.Number();</code></pre></dd> |
| 51 |
<dt>array_comment.json</dt> |
| 52 |
<dt>/Users/a12057/scm/github.com/fkei/JSON.minify/test/test-minify.json.js</dt> |
| 53 |
<dd><pre><code>var json = fs.readFileSync(__dirname + '/array_comment.json', 'utf8'); |
| 54 |
var res = JSON.parse(JSON.minify(json)); |
| 55 |
should(res.length).be.exactly(3).and.be.a.Number(); |
| 56 |
should(res[0]['somethi""ng'].length).be.exactly(4).and.be.a.Number(); |
| 57 |
should(res[0]['somethi""ng'][3]).be.exactly(23).and.be.a.Number();</code></pre></dd> |
| 58 |
</dl> |
| 59 |
</section> |