7 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0">
8 <meta name=
"description" content=
"">
9 <meta name=
"author" content=
"">
12 <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
15 <link href=
"../../assets/css/vendor/morris.css" rel=
"stylesheet">
16 <link href=
"../../assets/css/vendor/bootstrap.css" rel=
"stylesheet">
17 <link href=
"../../assets/css/vendor/font-awesome.css" rel=
"stylesheet">
18 <link href=
"../../assets/css/vendor/font-awesome-ie7.css" rel=
"stylesheet">
19 <link href=
"../../assets/css/vendor/codemirror.css" rel=
"stylesheet">
20 <link href=
"../../assets/css/plato.css" rel=
"stylesheet">
21 <link href=
"../../assets/css/plato-file.css" rel=
"stylesheet">
27 <div class=
"navbar navbar-fixed-top">
28 <div class=
"container">
29 <a class=
"navbar-brand" href=
"http://github.com/jsoverson/plato">Plato on Github
</a>
30 <ul class=
"nav navbar-nav">
32 <a href=
"../../index.html">Report Home
</a>
38 <div class=
"jumbotron">
39 <div class=
"container">
40 <h1>minify.json.js
</h1>
44 <div class=
"container aggregate-stats">
46 <div class=
"col-md-6">
47 <h2 class=
"header">Maintainability
<a href=
"http://blogs.msdn.com/b/codeanalysis/archive/2007/11/20/maintainability-index-range-and-meaning.aspx"><i class=
"icon icon-info-sign" rel=
"popover" data-placement=
"top" data-trigger=
"hover" data-content=
"A value between 0 and 100 that represents the relative ease of maintaining the code. A high value means better maintainability." data-original-title=
"Maintainability Index"></i></a></h2>
48 <p class=
"stat">48.77</p>
50 <div class=
"col-md-6">
51 <h2 class=
"header">Lines of code
<i class=
"icon icon-info-sign" rel=
"popover" data-placement=
"top" data-trigger=
"hover" data-content=
"Source Lines of Code / Logical Lines of Code" data-original-title=
"SLOC/LSLOC"></i></h2>
52 <p class=
"stat">81</p>
55 <div class=
"row historical">
56 <div class=
"col-md-6">
57 <p id=
"chart_historical_maint" class=
"chart"></p>
59 <div class=
"col-md-6">
60 <p id=
"chart_historical_sloc" class=
"chart"></p>
64 <div class=
"col-md-6">
65 <h2 class=
"header">Difficulty
<a href=
"http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class=
"icon icon-info-sign" rel=
"popover" data-placement=
"top" data-trigger=
"hover" data-content=
"The difficulty measure is related to the difficulty of the program to write or understand." data-original-title=
"Difficulty"></i></a></h2>
66 <p class=
"stat">32.34</p>
68 <div class=
"col-md-6">
69 <h2 class=
"header">Estimated Errors
<a href=
"http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class=
"icon icon-info-sign" rel=
"popover" data-placement=
"top" data-trigger=
"hover" data-content=
"Halstead's delivered bugs is an estimate for the number of errors in the implementation." data-original-title=
"Delivered Bugs"></i></a></h2>
70 <p class=
"stat">0.62</p>
75 <div class=
"container charts">
77 <h2 class=
"header">Function weight
</h2>
80 <div class=
"col-md-6">
81 <h3 class=
"chart-header">By Complexity
<a href=
"http://en.wikipedia.org/wiki/Cyclomatic_complexity"><i class=
"icon icon-info-sign" rel=
"popover" data-placement=
"top" data-trigger=
"hover" data-content=
"This metric counts the number of distinct paths through a block of code. Lower values are better." data-original-title=
"Cyclomatic Complexity"></i></a></h3>
82 <div id=
"fn-by-complexity" class=
"stat"></div>
84 <div class=
"col-md-6">
85 <h3 class=
"chart-header">By SLOC
<i class=
"icon icon-info-sign" rel=
"popover" data-placement=
"top" data-trigger=
"hover" data-content=
"Source Lines of Code / Logical Lines of Code" data-original-title=
"SLOC/LSLOC"></i></h3>
86 <div id=
"fn-by-sloc" class=
"stat"></div>
91 <div class=
"container">
93 <textarea id=
"file-source" class=
"col-md-12">/*! JSON.minify()
98 * @name minify.json.js
99 * @author Kei Funagayama
<kei.topaz@gmail.com
100 * @overview JSON.minify
107 'use strict
';
112 * @param {Object} Transformed data. format) json-like
116 * var json = { // hoge
117 *
"foo
":
"bar
",// this is cool
119 *
"baz
",
"bum
",
"zam
" // this is cool
124 var minify = function (json) {
126 var tokenizer = /
"|(\/\*)|(\*\/)|(\/\/)|\n|\r/g,
128 in_multiline_comment = false,
129 in_singleline_comment = false,
130 tmp, tmp2, new_str = [], ns =
0, from =
0, lc, rc
133 tokenizer.lastIndex =
0;
135 while ( tmp = tokenizer.exec(json) ) {
136 lc = RegExp.leftContext;
137 rc = RegExp.rightContext;
138 if (!in_multiline_comment
&& !in_singleline_comment) {
139 tmp2 = lc.substring(from);
141 tmp2 = tmp2.replace(/(\n|\r|\s)*/g,
"");
143 new_str[ns++] = tmp2;
145 from = tokenizer.lastIndex;
147 if (tmp[
0] ===
"\
"" && !in_multiline_comment
&& !in_singleline_comment) {
148 tmp2 = lc.match(/(\\)*$/);
149 if (!in_string || !tmp2 || (tmp2[
0].length %
2) ===
0) { // start of string with
", or unescaped
" character found to end string
150 in_string = !in_string;
152 from--; // include
" character in next catch
153 rc = json.substring(from);
155 else if (tmp[
0] ===
"/*
" && !in_string
&& !in_multiline_comment
&& !in_singleline_comment) {
156 in_multiline_comment = true;
158 else if (tmp[
0] ===
"*/
" && !in_string
&& in_multiline_comment
&& !in_singleline_comment) {
159 in_multiline_comment = false;
161 else if (tmp[
0] ===
"//
" && !in_string
&& !in_multiline_comment
&& !in_singleline_comment) {
162 in_singleline_comment = true;
164 else if ((tmp[
0] ===
"\n
" || tmp[
0] ===
"\r
")
&& !in_string
&& !in_multiline_comment
&& in_singleline_comment) {
165 in_singleline_comment = false;
167 else if (!in_multiline_comment
&& !in_singleline_comment
&& !(/\n|\r|\s/.test(tmp[
0]))) {
168 new_str[ns++] = tmp[
0];
172 return new_str.join(
"");
175 if (typeof module !==
'undefined
' && module.exports) {
177 module.exports = minify;
178 JSON.minify = minify;
180 // others, export global
181 if (typeof global.JSON ===
"undefined
" || !global.JSON) {
184 global.JSON.minify = minify;
190 <footer class=
"footer">
191 <div class=
"container">
196 <script type=
"text/html" id=
"complexity-popover-template">
197 <div class=
"complexity-notice">
198 Complexity : {{ complexity.cyclomatic }}
<br>
199 Length : {{ complexity.halstead.length }}
<br>
200 Difficulty : {{ complexity.halstead.difficulty.toFixed(
2) }}
<br>
201 Est # bugs : {{ complexity.halstead.bugs.toFixed(
2) }}
<br>
205 <script type=
"text/javascript" src=
"../../assets/scripts/bundles/core-bundle.js"></script>
206 <script type=
"text/javascript" src=
"../../assets/scripts/bundles/codemirror.js"></script>
207 <script type=
"text/javascript" src=
"../../assets/scripts/codemirror.markpopovertext.js"></script>
208 <script type=
"text/javascript" src=
"report.js"></script>
209 <script type=
"text/javascript" src=
"report.history.js"></script>
210 <script type=
"text/javascript" src=
"../../assets/scripts/plato-file.js"></script>