UNPKG

twreporter-react

Version:

React-Redux site for The Reporter Foundation in Taiwan

270 lines (269 loc) 10.6 kB
<!doctype html> <html lang="en"> <head> <title>Code coverage report for lib/collect.js</title> <meta charset="utf-8" /> <link rel="stylesheet" href="../prettify.css" /> <link rel="stylesheet" href="../base.css" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type='text/css'> .coverage-summary .sorter { background-image: url(../sort-arrow-sprite.png); } </style> </head> <body> <div class='wrapper'> <div class='pad1'> <h1> <a href="../index.html">all files</a> / <a href="index.html">lib/</a> collect.js </h1> <div class='clearfix'> <div class='fl pad1y space-right2'> <span class="strong">12.77% </span> <span class="quiet">Statements</span> <span class='fraction'>6/47</span> </div> <div class='fl pad1y space-right2'> <span class="strong">0% </span> <span class="quiet">Branches</span> <span class='fraction'>0/16</span> </div> <div class='fl pad1y space-right2'> <span class="strong">0% </span> <span class="quiet">Functions</span> <span class='fraction'>0/9</span> </div> <div class='fl pad1y space-right2'> <span class="strong">15% </span> <span class="quiet">Lines</span> <span class='fraction'>6/40</span> </div> </div> </div> <div class='status-line low'></div> <pre><table class="coverage"> <tr><td class="line-count quiet">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</td><td class="line-coverage quiet"><span class="cline-any cline-yes"></span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-yes"></span> <span class="cline-any cline-no">&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-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-yes"></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-no">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-yes"></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-no">&nbsp;</span> <span class="cline-any cline-yes"></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-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-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-no">&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-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-yes"></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-no">&nbsp;</span> <span class="cline-any cline-no">&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-no">&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-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">module.exports = collect &nbsp; <span class="fstat-no" title="function not covered" >function collect (stream) {</span> <span class="cstat-no" title="statement not covered" > if (stream._collected) <span class="cstat-no" title="statement not covered" >return</span></span> &nbsp; <span class="cstat-no" title="statement not covered" > stream._collected = true</span> <span class="cstat-no" title="statement not covered" > stream.pause()</span> &nbsp; <span class="cstat-no" title="statement not covered" > stream.on('data', save)</span> <span class="cstat-no" title="statement not covered" > stream.on('end', save)</span> <span class="cstat-no" title="statement not covered" > var buf = []</span> <span class="fstat-no" title="function not covered" > function save (b) {</span> <span class="cstat-no" title="statement not covered" > if (typeof b === 'string') <span class="cstat-no" title="statement not covered" >b = new Buffer(b)</span></span> <span class="cstat-no" title="statement not covered" > if (Buffer.isBuffer(b) &amp;&amp; !b.length) <span class="cstat-no" title="statement not covered" >return</span></span> <span class="cstat-no" title="statement not covered" > buf.push(b)</span> } &nbsp; <span class="cstat-no" title="statement not covered" > stream.on('entry', saveEntry)</span> <span class="cstat-no" title="statement not covered" > var entryBuffer = []</span> <span class="fstat-no" title="function not covered" > function saveEntry (e) {</span> <span class="cstat-no" title="statement not covered" > collect(e)</span> <span class="cstat-no" title="statement not covered" > entryBuffer.push(e)</span> } &nbsp; <span class="cstat-no" title="statement not covered" > stream.on('proxy', proxyPause)</span> <span class="fstat-no" title="function not covered" > function proxyPause (p) {</span> <span class="cstat-no" title="statement not covered" > p.pause()</span> } &nbsp; // replace the pipe method with a new version that will // unlock the buffered stuff. if you just call .pipe() // without a destination, then it'll re-play the events. <span class="cstat-no" title="statement not covered" > stream.pipe = (<span class="fstat-no" title="function not covered" >function (orig) {</span></span> <span class="cstat-no" title="statement not covered" > return <span class="fstat-no" title="function not covered" >function (dest) {</span></span> // console.error(' === open the pipes', dest &amp;&amp; dest.path) &nbsp; // let the entries flow through one at a time. // Once they're all done, then we can resume completely. <span class="cstat-no" title="statement not covered" > var e = 0</span> ;<span class="cstat-no" title="statement not covered" >(<span class="fstat-no" title="function not covered" >function unblockEntry () {</span></span> <span class="cstat-no" title="statement not covered" > var entry = entryBuffer[e++]</span> // console.error(" ==== unblock entry", entry &amp;&amp; entry.path) <span class="cstat-no" title="statement not covered" > if (!entry) <span class="cstat-no" title="statement not covered" >return resume()</span></span> <span class="cstat-no" title="statement not covered" > entry.on('end', unblockEntry)</span> <span class="cstat-no" title="statement not covered" > if (dest) <span class="cstat-no" title="statement not covered" >dest.add(entry)</span></span> else <span class="cstat-no" title="statement not covered" >stream.emit('entry', entry)</span> })() &nbsp; <span class="fstat-no" title="function not covered" > function resume () {</span> <span class="cstat-no" title="statement not covered" > stream.removeListener('entry', saveEntry)</span> <span class="cstat-no" title="statement not covered" > stream.removeListener('data', save)</span> <span class="cstat-no" title="statement not covered" > stream.removeListener('end', save)</span> &nbsp; <span class="cstat-no" title="statement not covered" > stream.pipe = orig</span> <span class="cstat-no" title="statement not covered" > if (dest) <span class="cstat-no" title="statement not covered" >stream.pipe(dest)</span></span> &nbsp; <span class="cstat-no" title="statement not covered" > buf.forEach(<span class="fstat-no" title="function not covered" >function (b) {</span></span> <span class="cstat-no" title="statement not covered" > if (b) <span class="cstat-no" title="statement not covered" >stream.emit('data', b)</span></span> else <span class="cstat-no" title="statement not covered" >stream.emit('end')</span> }) &nbsp; <span class="cstat-no" title="statement not covered" > stream.resume()</span> } &nbsp; <span class="cstat-no" title="statement not covered" > return dest</span> } })(stream.pipe) } &nbsp;</pre></td></tr> </table></pre> <div class='push'></div><!-- for sticky footer --> </div><!-- /wrapper --> <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Apr 29 2016 17:58:18 GMT-0700 (PDT) </div> </div> <script src="../prettify.js"></script> <script> window.onload = function () { if (typeof prettyPrint === 'function') { prettyPrint(); } }; </script> <script src="../sorter.js"></script> </body> </html>