<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for utf8.js/utf8.js</title>
    <meta charset="utf-8">

    <link rel="stylesheet" href="../prettify.css">

    <style>
        body, html {
            margin:0; padding: 0;
        }
        body {
            font-family: Helvetica Neue, Helvetica,Arial;
            font-size: 10pt;
        }
        div.header, div.footer {
            background: #eee;
            padding: 1em;
        }
        div.header {
            z-index: 100;
            position: fixed;
            top: 0;
            border-bottom: 1px solid #666;
            width: 100%;
        }
        div.footer {
            border-top: 1px solid #666;
        }
        div.body {
            margin-top: 10em;
        }
        div.meta {
            font-size: 90%;
            text-align: center;
        }
        h1, h2, h3 {
            font-weight: normal;
        }
        h1 {
            font-size: 12pt;
        }
        h2 {
            font-size: 10pt;
        }
        pre {
            font-family: Consolas, Menlo, Monaco, monospace;
            margin: 0;
            padding: 0;
            line-height: 14px;
            font-size: 14px;
            -moz-tab-size: 2;
            -o-tab-size:  2;
            tab-size: 2;
        }

        div.path { font-size: 110%; }
        div.path a:link, div.path a:visited { color: #000; }
        table.coverage { border-collapse: collapse; margin:0; padding: 0 }

        table.coverage td {
            margin: 0;
            padding: 0;
            color: #111;
            vertical-align: top;
        }
        table.coverage td.line-count {
            width: 50px;
            text-align: right;
            padding-right: 5px;
        }
        table.coverage td.line-coverage {
            color: #777 !important;
            text-align: right;
            border-left: 1px solid #666;
            border-right: 1px solid #666;
        }

        table.coverage td.text {
        }

        table.coverage td span.cline-any {
            display: inline-block;
            padding: 0 5px;
            width: 40px;
        }
        table.coverage td span.cline-neutral {
            background: #eee;
        }
        table.coverage td span.cline-yes {
            background: #b5d592;
            color: #999;
        }
        table.coverage td span.cline-no {
            background: #fc8c84;
        }

        .cstat-yes { color: #111; }
        .cstat-no { background: #fc8c84; color: #111; }
        .fstat-no { background: #ffc520; color: #111 !important; }
        .cbranch-no { background:  yellow !important; color: #111; }
        .missing-if-branch {
            display: inline-block;
            margin-right: 10px;
            position: relative;
            padding: 0 4px;
            background: black;
            color: yellow;
            xtext-decoration: line-through;
        }
        .missing-if-branch .typ {
            color: inherit !important;
        }

        .entity, .metric { font-weight: bold; }
        .metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; }
        .metric small { font-size: 80%; font-weight: normal; color: #666; }

        div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; }
        div.coverage-summary td, div.coverage-summary table  th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; }
        div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; }
        div.coverage-summary th.file { border-right: none !important; }
        div.coverage-summary th.pic { border-left: none !important; text-align: right; }
        div.coverage-summary th.pct { border-right: none !important; }
        div.coverage-summary th.abs { border-left: none !important; text-align: right; }
        div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; }
        div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; }
        div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap;  }
        div.coverage-summary td.pic { min-width: 120px !important;  }
        div.coverage-summary a:link { text-decoration: none; color: #000; }
        div.coverage-summary a:visited { text-decoration: none; color: #333; }
        div.coverage-summary a:hover { text-decoration: underline; }
        div.coverage-summary tfoot td { border-top: 1px solid #666; }

        div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator {
            height: 10px;
            width: 7px;
            display: inline-block;
            margin-left: 0.5em;
        }
        div.coverage-summary .yui3-datatable-sort-indicator {
            background: url("http://yui.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent;
        }
        div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator {
            background-position: 0 -20px;
        }
        div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator {
            background-position: 0 -10px;
        }

        .high { background: #b5d592 !important; }
        .medium { background: #ffe87c !important; }
        .low { background: #fc8c84 !important; }

        span.cover-fill, span.cover-empty {
            display:inline-block;
            border:1px solid #444;
            background: white;
            height: 12px;
        }
        span.cover-fill {
            background: #ccc;
            border-right: 1px solid #444;
        }
        span.cover-empty {
            background: white;
            border-left: none;
        }
        span.cover-full {
            border-right: none !important;
        }
        pre.prettyprint {
            border: none !important;
            padding: 0 !important;
            margin: 0 !important;
        }
        .com { color: #999 !important; }
    </style>
</head>
<body>
<div class="header high">
    <h1>Code coverage report for <span class="entity">utf8.js/utf8.js</span></h1>
    <h2>
        
        Statements: <span class="metric">92.31% <small>(120 / 130)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Branches: <span class="metric">78.79% <small>(52 / 66)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Functions: <span class="metric">90% <small>(9 / 10)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Lines: <span class="metric">92.31% <small>(120 / 130)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
    </h2>
    <div class="path"><a href="../index.html">All files</a> &#187; <a href="index.html">utf8.js/</a> &#187; utf8.js</div>
</div>
<div class="body">
<pre><table class="coverage">
<tr><td class="line-count">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242</td><td class="line-coverage"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-yes">128</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-yes">8</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">120</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">52</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">29</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">59</span>
<span class="cline-any cline-yes">57</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">31</span>
<span class="cline-any cline-yes">4</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-yes">3</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">27</span>
<span class="cline-any cline-yes">20</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-yes">19</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">6</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-yes">5</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">28</span>
<span class="cline-any cline-yes">32</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">24</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-yes">1</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/*! http://mths.be/utf8js v2.0.0 by @mathias */
;(function(root) {
&nbsp;
	// Detect free variables `exports`
	var freeExports = typeof exports == 'object' &amp;&amp; exports;
&nbsp;
	// Detect free variable `module`
	var freeModule = typeof module == 'object' &amp;&amp; module &amp;&amp;
		module.exports == freeExports &amp;&amp; module;
&nbsp;
	// Detect free variable `global`, from Node.js or Browserified code,
	// and use it as `root`
	var freeGlobal = typeof global == 'object' &amp;&amp; global;
	<span class="missing-if-branch" title="else path not taken"" >E</span>if (freeGlobal.global === freeGlobal || <span class="branch-1 cbranch-no" title="branch not covered" >freeGlobal.window === freeGlobal)</span> {
		root = freeGlobal;
	}
&nbsp;
	/*--------------------------------------------------------------------------*/
&nbsp;
	var stringFromCharCode = String.fromCharCode;
&nbsp;
	// Taken from http://mths.be/punycode
	function ucs2decode(string) {
		var output = [];
		var counter = 0;
		var length = string.length;
		var value;
		var extra;
		while (counter &lt; length) {
			value = string.charCodeAt(counter++);
			if (value &gt;= 0xD800 &amp;&amp; value &lt;= 0xDBFF &amp;&amp; counter &lt; length) {
				// high surrogate, and there is a next character
				extra = string.charCodeAt(counter++);
				if ((extra &amp; 0xFC00) == 0xDC00) { // low surrogate
					output.push(((value &amp; 0x3FF) &lt;&lt; 10) + (extra &amp; 0x3FF) + 0x10000);
				} else {
					// unmatched surrogate; only append this code unit, in case the next
					// code unit is the high surrogate of a surrogate pair
					output.push(value);
					counter--;
				}
			} else {
				output.push(value);
			}
		}
		return output;
	}
&nbsp;
	// Taken from http://mths.be/punycode
	function ucs2encode(array) {
		var length = array.length;
		var index = -1;
		var value;
		var output = '';
		while (++index &lt; length) {
			value = array[index];
			if (value &gt; 0xFFFF) {
				value -= 0x10000;
				output += stringFromCharCode(value &gt;&gt;&gt; 10 &amp; 0x3FF | 0xD800);
				value = 0xDC00 | value &amp; 0x3FF;
			}
			output += stringFromCharCode(value);
		}
		return output;
	}
&nbsp;
	/*--------------------------------------------------------------------------*/
&nbsp;
	// https://github.com/php/php-src/blob/master/ext/mbstring/oniguruma/enc/utf8.c
	function createByte(codePoint, shift) {
		return stringFromCharCode(((codePoint &gt;&gt; shift) &amp; 0x3F) | 0x80);
	}
&nbsp;
	function encodeCodePoint(codePoint) {
		if ((codePoint &amp; 0xFFFFFF80) == 0) { // 1-byte sequence
			return stringFromCharCode(codePoint);
		}
		var symbol = '';
		if ((codePoint &amp; 0xFFFFF800) == 0) { // 2-byte sequence
			symbol = stringFromCharCode(((codePoint &gt;&gt; 6) &amp; 0x1F) | 0xC0);
		}
		else if ((codePoint &amp; 0xFFFF0000) == 0) { // 3-byte sequence
			symbol = stringFromCharCode(((codePoint &gt;&gt; 12) &amp; 0x0F) | 0xE0);
			symbol += createByte(codePoint, 6);
		}
		else <span class="missing-if-branch" title="else path not taken"" >E</span>if ((codePoint &amp; 0xFFE00000) == 0) { // 4-byte sequence
			symbol = stringFromCharCode(((codePoint &gt;&gt; 18) &amp; 0x07) | 0xF0);
			symbol += createByte(codePoint, 12);
			symbol += createByte(codePoint, 6);
		}
		symbol += stringFromCharCode((codePoint &amp; 0x3F) | 0x80);
		return symbol;
	}
&nbsp;
	function utf8encode(string) {
		var codePoints = ucs2decode(string);
&nbsp;
		// console.log(JSON.stringify(codePoints.map(function(x) {
		// 	return 'U+' + x.toString(16).toUpperCase();
		// })));
&nbsp;
		var length = codePoints.length;
		var index = -1;
		var codePoint;
		var byteString = '';
		while (++index &lt; length) {
			codePoint = codePoints[index];
			byteString += encodeCodePoint(codePoint);
		}
		return byteString;
	}
&nbsp;
	/*--------------------------------------------------------------------------*/
&nbsp;
	// https://github.com/php/php-src/blob/master/ext/json/utf8_decode.c
	function readContinuationByte() {
		if (byteIndex &gt;= byteCount) {
			throw Error('Invalid byte index');
		}
&nbsp;
		var continuationByte = byteArray[byteIndex] &amp; 0xFF;
		byteIndex++;
&nbsp;
		if ((continuationByte &amp; 0xC0) == 0x80) {
			return continuationByte &amp; 0x3F;
		}
&nbsp;
		// If we end up here, it’s not a continuation byte
		throw Error('Invalid continuation byte');
	}
&nbsp;
	function decodeSymbol() {
		var byte1;
		var byte2;
		var byte3;
		var byte4;
		var codePoint;
&nbsp;
		<span class="missing-if-branch" title="if path not taken"" >I</span>if (byteIndex &gt; byteCount) {
<span class="cstat-no" title="statement not covered" >			throw Error('Invalid byte index');</span>
		}
&nbsp;
		if (byteIndex == byteCount) {
			return false;
		}
&nbsp;
		// Read first byte
		byte1 = byteArray[byteIndex] &amp; 0xFF;
		byteIndex++;
&nbsp;
		// 1-byte sequence (no continuation bytes)
		if ((byte1 &amp; 0x80) == 0) {
			return byte1;
		}
&nbsp;
		// 2-byte sequence
		if ((byte1 &amp; 0xE0) == 0xC0) {
			var byte2 = readContinuationByte();
			codePoint = ((byte1 &amp; 0x1F) &lt;&lt; 6) | byte2;
			<span class="missing-if-branch" title="else path not taken"" >E</span>if (codePoint &gt;= 0x80) {
				return codePoint;
			} else {
<span class="cstat-no" title="statement not covered" >				throw Error('Invalid continuation byte');</span>
			}
		}
&nbsp;
		// 3-byte sequence (may include unpaired surrogates)
		if ((byte1 &amp; 0xF0) == 0xE0) {
			byte2 = readContinuationByte();
			byte3 = readContinuationByte();
			codePoint = ((byte1 &amp; 0x0F) &lt;&lt; 12) | (byte2 &lt;&lt; 6) | byte3;
			<span class="missing-if-branch" title="else path not taken"" >E</span>if (codePoint &gt;= 0x0800) {
				return codePoint;
			} else {
<span class="cstat-no" title="statement not covered" >				throw Error('Invalid continuation byte');</span>
			}
		}
&nbsp;
		// 4-byte sequence
		if ((byte1 &amp; 0xF8) == 0xF0) {
			byte2 = readContinuationByte();
			byte3 = readContinuationByte();
			byte4 = readContinuationByte();
			codePoint = ((byte1 &amp; 0x0F) &lt;&lt; 0x12) | (byte2 &lt;&lt; 0x0C) |
				(byte3 &lt;&lt; 0x06) | byte4;
			<span class="missing-if-branch" title="else path not taken"" >E</span>if (codePoint &gt;= 0x010000 &amp;&amp; codePoint &lt;= 0x10FFFF) {
				return codePoint;
			}
		}
&nbsp;
		throw Error('Invalid UTF-8 detected');
	}
&nbsp;
	var byteArray;
	var byteCount;
	var byteIndex;
	function utf8decode(byteString) {
		byteArray = ucs2decode(byteString);
		byteCount = byteArray.length;
		byteIndex = 0;
		var codePoints = [];
		var tmp;
		while ((tmp = decodeSymbol()) !== false) {
			codePoints.push(tmp);
		}
		return ucs2encode(codePoints);
	}
&nbsp;
	/*--------------------------------------------------------------------------*/
&nbsp;
	var utf8 = {
		'version': '2.0.0',
		'encode': utf8encode,
		'decode': utf8decode
	};
&nbsp;
	// Some AMD build optimizers, like r.js, check for specific condition patterns
	// like the following:
	<span class="missing-if-branch" title="if path not taken"" >I</span>if (
		typeof define == 'function' &amp;&amp;
<span class="branch-1 cbranch-no" title="branch not covered" >		typeof define.amd == 'object' </span>&amp;&amp;
<span class="branch-2 cbranch-no" title="branch not covered" >		define.amd</span>
	) {
<span class="cstat-no" title="statement not covered" >		define(<span class="fstat-no" title="function not covered" >function() {</span></span>
<span class="cstat-no" title="statement not covered" >			return utf8;</span>
		});
	}	else <span class="missing-if-branch" title="else path not taken"" >E</span>if (freeExports &amp;&amp; !freeExports.nodeType) {
		<span class="missing-if-branch" title="else path not taken"" >E</span>if (freeModule) { // in Node.js or RingoJS v0.8.0+
			freeModule.exports = utf8;
		} else { // in Narwhal or RingoJS v0.7.0-
<span class="cstat-no" title="statement not covered" >			var object = {};</span>
<span class="cstat-no" title="statement not covered" >			var hasOwnProperty = object.hasOwnProperty;</span>
<span class="cstat-no" title="statement not covered" >			for (var key in utf8) {</span>
<span class="cstat-no" title="statement not covered" >				hasOwnProperty.call(utf8, key) &amp;&amp; (freeExports[key] = utf8[key]);</span>
			}
		}
	} else { // in Rhino or a web browser
<span class="cstat-no" title="statement not covered" >		root.utf8 = utf8;</span>
	}
&nbsp;
}(this));
&nbsp;</pre></td></tr>
</table></pre>

</div>
<div class="footer">
    <div class="meta">Generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Jun 20 2013 14:00:05 GMT+0200 (CEST)</div>
</div>

<script src="../prettify.js"></script>

<script src="http://yui.yahooapis.com/3.6.0/build/yui/yui-min.js"></script>
<script>

    YUI().use('datatable', function (Y) {

        var formatters = {
          pct: function (o) {
              o.className += o.record.get('classes')[o.column.key];
              try {
                  return o.value.toFixed(2) + '%';
              } catch (ex) { return o.value + '%'; }
          },
          html: function (o) {
              o.className += o.record.get('classes')[o.column.key];
              return o.record.get(o.column.key + '_html');
          }
        },
          defaultFormatter = function (o) {
              o.className += o.record.get('classes')[o.column.key];
              return o.value;
          };

        function getColumns(theadNode) {
            var colNodes = theadNode.all('tr th'),
                cols = [],
                col;
            colNodes.each(function (colNode) {
                col = {
                    key: colNode.getAttribute('data-col'),
                    label: colNode.get('innerHTML') || ' ',
                    sortable: !colNode.getAttribute('data-nosort'),
                    className: colNode.getAttribute('class'),
                    type: colNode.getAttribute('data-type'),
                    allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html'
                };
                col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter;
                cols.push(col);
            });
            return cols;
        }

        function getRowData(trNode, cols) {
            var tdNodes = trNode.all('td'),
                    i,
                    row = { classes: {} },
                    node,
                    name;
            for (i = 0; i < cols.length; i += 1) {
                name = cols[i].key;
                node = tdNodes.item(i);
                row[name] = node.getAttribute('data-value') || node.get('innerHTML');
                row[name + '_html'] = node.get('innerHTML');
                row.classes[name] = node.getAttribute('class');
                //Y.log('Name: ' + name + '; Value: ' + row[name]);
                if (cols[i].type === 'number') { row[name] = row[name] * 1; }
            }
            //Y.log(row);
            return row;
        }

        function getData(tbodyNode, cols) {
            var data = [];
            tbodyNode.all('tr').each(function (trNode) {
                data.push(getRowData(trNode, cols));
            });
            return data;
        }

        function replaceTable(node) {
            if (!node) { return; }
            var cols = getColumns(node.one('thead')),
                data = getData(node.one('tbody'), cols),
                table,
                parent = node.get('parentNode');

            table = new Y.DataTable({
                columns: cols,
                data: data,
                sortBy: 'file'
            });
            parent.set('innerHTML', '');
            table.render(parent);
        }

        Y.on('domready', function () {
            replaceTable(Y.one('div.coverage-summary table'));
            if (typeof prettyPrint === 'function') {
                prettyPrint();
            }
        });
    });
</script>
</body>
</html>
