Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update coverage

  • Loading branch information...
commit 1561fceddce92bb35d2dc7897605e4b6efd35ad2 1 parent 7bebba5
@wdavidw authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  doc/coverage.html
View
2  doc/coverage.html
@@ -338,4 +338,4 @@
code .string { color: #5890AD }
code .keyword { color: #8A6343 }
code .number { color: #2F6FAD }
-</style></head><body><div id="coverage"><h1 id="overview">Coverage</h1><div id="menu"><li><a href="#overview">overview</a></li><li><span class="cov high">100</span><a href="#each.js"><span class="basename">each.js</span></a></li><a id="logo" href="http://visionmedia.github.com/mocha/">m</a></div><div id="stats" class="high"><div class="percentage">100%</div><div class="sloc">93</div><div class="hits">93</div><div class="misses">0</div></div><div id="files"><div class="file"><h2 id="each.js">each.js</h2><div id="stats" class="high"><div class="percentage">100%</div><div class="sloc">93</div><div class="hits">93</div><div class="misses">0</div></div><table id="source"><thead><tr><th>Line</th><th>Hits</th><th>Source</th></tr></thead><tbody><tr><td class="line">1</td><td class="hits"></td><td class="source">// Generated by CoffeeScript 1.4.0</td></tr><tr><td class="line">2</td><td class="hits"></td><td class="source">/*</td></tr><tr><td class="line">3</td><td class="hits"></td><td class="source">each(elements)</td></tr><tr><td class="line">4</td><td class="hits"></td><td class="source">.mode(parallel=false|true|integer)</td></tr><tr><td class="line">5</td><td class="hits"></td><td class="source">.on('item', callback)</td></tr><tr><td class="line">6</td><td class="hits"></td><td class="source">.on('error', callback)</td></tr><tr><td class="line">7</td><td class="hits"></td><td class="source">.on('end', callback)</td></tr><tr><td class="line">8</td><td class="hits"></td><td class="source">.on('both', callback)</td></tr><tr><td class="line">9</td><td class="hits"></td><td class="source">Chained and parallel async iterator in one elegant function</td></tr><tr><td class="line">10</td><td class="hits"></td><td class="source">*/</td></tr><tr><td class="line">11</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">12</td><td class="hits">1</td><td class="source">module.exports = function(elements) {</td></tr><tr class="hit"> <td class="line">13</td><td class="hits">43</td><td class="source"> var eacher, errors, events, isObject, keys, next, parallel, run, times, type;</td></tr><tr class="hit"> <td class="line">14</td><td class="hits">43</td><td class="source"> type = typeof elements;</td></tr><tr class="hit"> <td class="line">15</td><td class="hits">43</td><td class="source"> if (elements === null || type === 'undefined' || type === 'number' || type === 'string' || type === 'function' || type === 'boolean') {</td></tr><tr class="hit"> <td class="line">16</td><td class="hits">16</td><td class="source"> elements = [elements];</td></tr><tr class="hit"> <td class="line">17</td><td class="hits">27</td><td class="source"> } else if (!Array.isArray(elements)) {</td></tr><tr class="hit"> <td class="line">18</td><td class="hits">4</td><td class="source"> isObject = true;</td></tr><tr><td class="line">19</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">20</td><td class="hits">43</td><td class="source"> if (isObject) {</td></tr><tr class="hit"> <td class="line">21</td><td class="hits">4</td><td class="source"> keys = Object.keys(elements);</td></tr><tr><td class="line">22</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">23</td><td class="hits">43</td><td class="source"> errors = [];</td></tr><tr class="hit"> <td class="line">24</td><td class="hits">43</td><td class="source"> parallel = 1;</td></tr><tr class="hit"> <td class="line">25</td><td class="hits">43</td><td class="source"> events = {</td></tr><tr><td class="line">26</td><td class="hits"></td><td class="source"> item: [],</td></tr><tr><td class="line">27</td><td class="hits"></td><td class="source"> error: [],</td></tr><tr><td class="line">28</td><td class="hits"></td><td class="source"> end: [],</td></tr><tr><td class="line">29</td><td class="hits"></td><td class="source"> both: []</td></tr><tr><td class="line">30</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">31</td><td class="hits">43</td><td class="source"> times = [];</td></tr><tr class="hit"> <td class="line">32</td><td class="hits">43</td><td class="source"> eacher = {};</td></tr><tr class="hit"> <td class="line">33</td><td class="hits">43</td><td class="source"> eacher.total = keys ? keys.length : elements.length;</td></tr><tr class="hit"> <td class="line">34</td><td class="hits">43</td><td class="source"> eacher.started = 0;</td></tr><tr class="hit"> <td class="line">35</td><td class="hits">43</td><td class="source"> eacher.done = 0;</td></tr><tr class="hit"> <td class="line">36</td><td class="hits">43</td><td class="source"> times = 1;</td></tr><tr class="hit"> <td class="line">37</td><td class="hits">43</td><td class="source"> eacher.paused = 0;</td></tr><tr class="hit"> <td class="line">38</td><td class="hits">43</td><td class="source"> eacher.readable = true;</td></tr><tr class="hit"> <td class="line">39</td><td class="hits">43</td><td class="source"> eacher.pause = function() {</td></tr><tr class="hit"> <td class="line">40</td><td class="hits">10</td><td class="source"> return eacher.paused++;</td></tr><tr><td class="line">41</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">42</td><td class="hits">43</td><td class="source"> eacher.resume = function() {</td></tr><tr class="hit"> <td class="line">43</td><td class="hits">10</td><td class="source"> eacher.paused--;</td></tr><tr class="hit"> <td class="line">44</td><td class="hits">10</td><td class="source"> return run();</td></tr><tr><td class="line">45</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">46</td><td class="hits">43</td><td class="source"> eacher.parallel = function(mode) {</td></tr><tr class="hit"> <td class="line">47</td><td class="hits">34</td><td class="source"> if (typeof mode === 'number') {</td></tr><tr class="hit"> <td class="line">48</td><td class="hits">15</td><td class="source"> parallel = mode;</td></tr><tr class="hit"> <td class="line">49</td><td class="hits">19</td><td class="source"> } else if (mode) {</td></tr><tr class="hit"> <td class="line">50</td><td class="hits">16</td><td class="source"> parallel = mode;</td></tr><tr><td class="line">51</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">52</td><td class="hits">3</td><td class="source"> parallel = 1;</td></tr><tr><td class="line">53</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">54</td><td class="hits">34</td><td class="source"> return eacher;</td></tr><tr><td class="line">55</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">56</td><td class="hits">43</td><td class="source"> eacher.times = function(t) {</td></tr><tr class="hit"> <td class="line">57</td><td class="hits">6</td><td class="source"> times = t;</td></tr><tr class="hit"> <td class="line">58</td><td class="hits">6</td><td class="source"> return eacher;</td></tr><tr><td class="line">59</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">60</td><td class="hits">43</td><td class="source"> eacher.on = function(ev, callback) {</td></tr><tr class="hit"> <td class="line">61</td><td class="hits">118</td><td class="source"> events[ev].push(callback);</td></tr><tr class="hit"> <td class="line">62</td><td class="hits">118</td><td class="source"> return eacher;</td></tr><tr><td class="line">63</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">64</td><td class="hits">43</td><td class="source"> run = function() {</td></tr><tr class="hit"> <td class="line">65</td><td class="hits">16690</td><td class="source"> var args, emit, emitError, index, lboth, lerror, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;</td></tr><tr class="hit"> <td class="line">66</td><td class="hits">16690</td><td class="source"> if (eacher.paused) {</td></tr><tr class="hit"> <td class="line">67</td><td class="hits">35</td><td class="source"> return;</td></tr><tr><td class="line">68</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">69</td><td class="hits">16655</td><td class="source"> if (eacher.done === eacher.total * times || (errors.length &amp;&amp; eacher.started === eacher.done)) {</td></tr><tr class="hit"> <td class="line">70</td><td class="hits">42</td><td class="source"> eacher.readable = false;</td></tr><tr class="hit"> <td class="line">71</td><td class="hits">42</td><td class="source"> if (errors.length) {</td></tr><tr class="hit"> <td class="line">72</td><td class="hits">8</td><td class="source"> if (parallel !== 1) {</td></tr><tr class="hit"> <td class="line">73</td><td class="hits">6</td><td class="source"> if (errors.length === 1) {</td></tr><tr class="hit"> <td class="line">74</td><td class="hits">3</td><td class="source"> args = [errors[0], errors];</td></tr><tr><td class="line">75</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">76</td><td class="hits">3</td><td class="source"> args = [new Error(&quot;Multiple errors (&quot; + errors.length + &quot;)&quot;), errors];</td></tr><tr><td class="line">77</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">78</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">79</td><td class="hits">2</td><td class="source"> args = [errors[0]];</td></tr><tr><td class="line">80</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">81</td><td class="hits">8</td><td class="source"> lerror = events.error.length;</td></tr><tr class="hit"> <td class="line">82</td><td class="hits">8</td><td class="source"> lboth = events.both.length;</td></tr><tr class="hit"> <td class="line">83</td><td class="hits">8</td><td class="source"> emitError = lerror || (!lerror &amp;&amp; !lboth);</td></tr><tr class="hit"> <td class="line">84</td><td class="hits">8</td><td class="source"> _ref = events.error;</td></tr><tr class="hit"> <td class="line">85</td><td class="hits">8</td><td class="source"> for (_i = 0, _len = _ref.length; _i &lt; _len; _i++) {</td></tr><tr class="hit"> <td class="line">86</td><td class="hits">6</td><td class="source"> emit = _ref[_i];</td></tr><tr class="hit"> <td class="line">87</td><td class="hits">6</td><td class="source"> if (emitError) {</td></tr><tr class="hit"> <td class="line">88</td><td class="hits">6</td><td class="source"> emit.apply(null, args);</td></tr><tr><td class="line">89</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">90</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">91</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">92</td><td class="hits">34</td><td class="source"> args = [];</td></tr><tr class="hit"> <td class="line">93</td><td class="hits">34</td><td class="source"> _ref1 = events.end;</td></tr><tr class="hit"> <td class="line">94</td><td class="hits">34</td><td class="source"> for (_j = 0, _len1 = _ref1.length; _j &lt; _len1; _j++) {</td></tr><tr class="hit"> <td class="line">95</td><td class="hits">28</td><td class="source"> emit = _ref1[_j];</td></tr><tr class="hit"> <td class="line">96</td><td class="hits">28</td><td class="source"> emit();</td></tr><tr><td class="line">97</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">98</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">99</td><td class="hits">42</td><td class="source"> _ref2 = events.both;</td></tr><tr class="hit"> <td class="line">100</td><td class="hits">42</td><td class="source"> for (_k = 0, _len2 = _ref2.length; _k &lt; _len2; _k++) {</td></tr><tr class="hit"> <td class="line">101</td><td class="hits">13</td><td class="source"> emit = _ref2[_k];</td></tr><tr class="hit"> <td class="line">102</td><td class="hits">13</td><td class="source"> emit.apply(null, args);</td></tr><tr><td class="line">103</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">104</td><td class="hits">42</td><td class="source"> return;</td></tr><tr><td class="line">105</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">106</td><td class="hits">16613</td><td class="source"> if (errors.length !== 0) {</td></tr><tr class="hit"> <td class="line">107</td><td class="hits">10</td><td class="source"> return;</td></tr><tr><td class="line">108</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">109</td><td class="hits">16603</td><td class="source"> while ((parallel === true ? (eacher.total * times - eacher.started) &gt; 0 : Math.min(parallel - eacher.started + eacher.done, eacher.total * times - eacher.started))) {</td></tr><tr class="hit"> <td class="line">110</td><td class="hits">16647</td><td class="source"> if (errors.length !== 0) {</td></tr><tr class="hit"> <td class="line">111</td><td class="hits">9</td><td class="source"> break;</td></tr><tr><td class="line">112</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">113</td><td class="hits">16638</td><td class="source"> index = Math.floor(eacher.started / times);</td></tr><tr class="hit"> <td class="line">114</td><td class="hits">16638</td><td class="source"> if (keys) {</td></tr><tr class="hit"> <td class="line">115</td><td class="hits">24</td><td class="source"> args = [next, keys[index], elements[keys[index]]];</td></tr><tr><td class="line">116</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">117</td><td class="hits">16614</td><td class="source"> args = [next, elements[index], index];</td></tr><tr><td class="line">118</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">119</td><td class="hits">16638</td><td class="source"> eacher.started++;</td></tr><tr class="hit"> <td class="line">120</td><td class="hits">16638</td><td class="source"> try {</td></tr><tr class="hit"> <td class="line">121</td><td class="hits">16638</td><td class="source"> _ref3 = events.item;</td></tr><tr class="hit"> <td class="line">122</td><td class="hits">16638</td><td class="source"> for (_l = 0, _len3 = _ref3.length; _l &lt; _len3; _l++) {</td></tr><tr class="hit"> <td class="line">123</td><td class="hits">16638</td><td class="source"> emit = _ref3[_l];</td></tr><tr class="hit"> <td class="line">124</td><td class="hits">16638</td><td class="source"> emit.apply(null, args);</td></tr><tr><td class="line">125</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">126</td><td class="hits"></td><td class="source"> } catch (e) {</td></tr><tr class="hit"> <td class="line">127</td><td class="hits">1</td><td class="source"> if (eacher.readable) {</td></tr><tr class="hit"> <td class="line">128</td><td class="hits">1</td><td class="source"> next(e);</td></tr><tr><td class="line">129</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">130</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">131</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">132</td><td class="hits">16603</td><td class="source"> return null;</td></tr><tr><td class="line">133</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">134</td><td class="hits">43</td><td class="source"> next = function(err) {</td></tr><tr class="hit"> <td class="line">135</td><td class="hits">16637</td><td class="source"> if ((err != null) &amp;&amp; err instanceof Error) {</td></tr><tr class="hit"> <td class="line">136</td><td class="hits">11</td><td class="source"> errors.push(err);</td></tr><tr><td class="line">137</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">138</td><td class="hits">16637</td><td class="source"> eacher.done++;</td></tr><tr class="hit"> <td class="line">139</td><td class="hits">16637</td><td class="source"> return run();</td></tr><tr><td class="line">140</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">141</td><td class="hits">43</td><td class="source"> process.nextTick(run);</td></tr><tr class="hit"> <td class="line">142</td><td class="hits">43</td><td class="source"> return eacher;</td></tr><tr><td class="line">143</td><td class="hits"></td><td class="source">};</td></tr></tbody></table></div></div></div></body></html>
+</style></head><body><div id="coverage"><h1 id="overview">Coverage</h1><div id="menu"><li><a href="#overview">overview</a></li><li><span class="cov high">99</span><a href="#each.js"><span class="basename">each.js</span></a></li><a id="logo" href="http://visionmedia.github.com/mocha/">m</a></div><div id="stats" class="high"><div class="percentage">99%</div><div class="sloc">106</div><div class="hits">105</div><div class="misses">1</div></div><div id="files"><div class="file"><h2 id="each.js">each.js</h2><div id="stats" class="high"><div class="percentage">99%</div><div class="sloc">106</div><div class="hits">105</div><div class="misses">1</div></div><table id="source"><thead><tr><th>Line</th><th>Hits</th><th>Source</th></tr></thead><tbody><tr><td class="line">1</td><td class="hits"></td><td class="source">// Generated by CoffeeScript 1.4.0</td></tr><tr><td class="line">2</td><td class="hits"></td><td class="source">/*</td></tr><tr><td class="line">3</td><td class="hits"></td><td class="source">each(elements)</td></tr><tr><td class="line">4</td><td class="hits"></td><td class="source">.mode(parallel=false|true|integer)</td></tr><tr><td class="line">5</td><td class="hits"></td><td class="source">.on('item', callback)</td></tr><tr><td class="line">6</td><td class="hits"></td><td class="source">.on('error', callback)</td></tr><tr><td class="line">7</td><td class="hits"></td><td class="source">.on('end', callback)</td></tr><tr><td class="line">8</td><td class="hits"></td><td class="source">.on('both', callback)</td></tr><tr><td class="line">9</td><td class="hits"></td><td class="source">Chained and parallel async iterator in one elegant function</td></tr><tr><td class="line">10</td><td class="hits"></td><td class="source">*/</td></tr><tr><td class="line">11</td><td class="hits"></td><td class="source"> </td></tr><tr class="hit"> <td class="line">12</td><td class="hits">1</td><td class="source">module.exports = function(elements) {</td></tr><tr class="hit"> <td class="line">13</td><td class="hits">52</td><td class="source"> var eacher, errors, events, isObject, keys, next, parallel, run, times, type;</td></tr><tr class="hit"> <td class="line">14</td><td class="hits">52</td><td class="source"> type = typeof elements;</td></tr><tr class="hit"> <td class="line">15</td><td class="hits">52</td><td class="source"> if (elements === null || type === 'undefined' || type === 'number' || type === 'string' || type === 'function' || type === 'boolean') {</td></tr><tr class="hit"> <td class="line">16</td><td class="hits">16</td><td class="source"> elements = [elements];</td></tr><tr class="hit"> <td class="line">17</td><td class="hits">36</td><td class="source"> } else if (!Array.isArray(elements)) {</td></tr><tr class="hit"> <td class="line">18</td><td class="hits">9</td><td class="source"> isObject = true;</td></tr><tr><td class="line">19</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">20</td><td class="hits">52</td><td class="source"> if (isObject) {</td></tr><tr class="hit"> <td class="line">21</td><td class="hits">9</td><td class="source"> keys = Object.keys(elements);</td></tr><tr><td class="line">22</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">23</td><td class="hits">52</td><td class="source"> errors = [];</td></tr><tr class="hit"> <td class="line">24</td><td class="hits">52</td><td class="source"> parallel = 1;</td></tr><tr class="hit"> <td class="line">25</td><td class="hits">52</td><td class="source"> events = {</td></tr><tr><td class="line">26</td><td class="hits"></td><td class="source"> item: [],</td></tr><tr><td class="line">27</td><td class="hits"></td><td class="source"> error: [],</td></tr><tr><td class="line">28</td><td class="hits"></td><td class="source"> end: [],</td></tr><tr><td class="line">29</td><td class="hits"></td><td class="source"> both: []</td></tr><tr><td class="line">30</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">31</td><td class="hits">52</td><td class="source"> times = [];</td></tr><tr class="hit"> <td class="line">32</td><td class="hits">52</td><td class="source"> eacher = {};</td></tr><tr class="hit"> <td class="line">33</td><td class="hits">52</td><td class="source"> eacher.total = keys ? keys.length : elements.length;</td></tr><tr class="hit"> <td class="line">34</td><td class="hits">52</td><td class="source"> eacher.started = 0;</td></tr><tr class="hit"> <td class="line">35</td><td class="hits">52</td><td class="source"> eacher.done = 0;</td></tr><tr class="hit"> <td class="line">36</td><td class="hits">52</td><td class="source"> times = 1;</td></tr><tr class="hit"> <td class="line">37</td><td class="hits">52</td><td class="source"> eacher.paused = 0;</td></tr><tr class="hit"> <td class="line">38</td><td class="hits">52</td><td class="source"> eacher.readable = true;</td></tr><tr class="hit"> <td class="line">39</td><td class="hits">52</td><td class="source"> eacher.pause = function() {</td></tr><tr class="hit"> <td class="line">40</td><td class="hits">10</td><td class="source"> return eacher.paused++;</td></tr><tr><td class="line">41</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">42</td><td class="hits">52</td><td class="source"> eacher.resume = function() {</td></tr><tr class="hit"> <td class="line">43</td><td class="hits">10</td><td class="source"> eacher.paused--;</td></tr><tr class="hit"> <td class="line">44</td><td class="hits">10</td><td class="source"> return run();</td></tr><tr><td class="line">45</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">46</td><td class="hits">52</td><td class="source"> eacher.parallel = function(mode) {</td></tr><tr class="hit"> <td class="line">47</td><td class="hits">34</td><td class="source"> if (typeof mode === 'number') {</td></tr><tr class="hit"> <td class="line">48</td><td class="hits">15</td><td class="source"> parallel = mode;</td></tr><tr class="hit"> <td class="line">49</td><td class="hits">19</td><td class="source"> } else if (mode) {</td></tr><tr class="hit"> <td class="line">50</td><td class="hits">16</td><td class="source"> parallel = mode;</td></tr><tr><td class="line">51</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">52</td><td class="hits">3</td><td class="source"> parallel = 1;</td></tr><tr><td class="line">53</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">54</td><td class="hits">34</td><td class="source"> return eacher;</td></tr><tr><td class="line">55</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">56</td><td class="hits">52</td><td class="source"> eacher.times = function(t) {</td></tr><tr class="hit"> <td class="line">57</td><td class="hits">6</td><td class="source"> times = t;</td></tr><tr class="hit"> <td class="line">58</td><td class="hits">6</td><td class="source"> return eacher;</td></tr><tr><td class="line">59</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">60</td><td class="hits">52</td><td class="source"> eacher.on = function(ev, callback) {</td></tr><tr class="hit"> <td class="line">61</td><td class="hits">136</td><td class="source"> events[ev].push(callback);</td></tr><tr class="hit"> <td class="line">62</td><td class="hits">136</td><td class="source"> return eacher;</td></tr><tr><td class="line">63</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">64</td><td class="hits">52</td><td class="source"> run = function() {</td></tr><tr class="hit"> <td class="line">65</td><td class="hits">16723</td><td class="source"> var args, emit, emitError, index, lboth, lerror, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;</td></tr><tr class="hit"> <td class="line">66</td><td class="hits">16723</td><td class="source"> if (eacher.paused) {</td></tr><tr class="hit"> <td class="line">67</td><td class="hits">35</td><td class="source"> return;</td></tr><tr><td class="line">68</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">69</td><td class="hits">16688</td><td class="source"> if (eacher.done === eacher.total * times || (errors.length &amp;&amp; eacher.started === eacher.done)) {</td></tr><tr class="hit"> <td class="line">70</td><td class="hits">52</td><td class="source"> eacher.readable = false;</td></tr><tr class="hit"> <td class="line">71</td><td class="hits">52</td><td class="source"> if (errors.length) {</td></tr><tr class="hit"> <td class="line">72</td><td class="hits">10</td><td class="source"> if (parallel !== 1) {</td></tr><tr class="hit"> <td class="line">73</td><td class="hits">6</td><td class="source"> if (errors.length === 1) {</td></tr><tr class="hit"> <td class="line">74</td><td class="hits">3</td><td class="source"> args = [errors[0], errors];</td></tr><tr><td class="line">75</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">76</td><td class="hits">3</td><td class="source"> args = [new Error(&quot;Multiple errors (&quot; + errors.length + &quot;)&quot;), errors];</td></tr><tr><td class="line">77</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">78</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">79</td><td class="hits">4</td><td class="source"> args = [errors[0]];</td></tr><tr><td class="line">80</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">81</td><td class="hits">10</td><td class="source"> lerror = events.error.length;</td></tr><tr class="hit"> <td class="line">82</td><td class="hits">10</td><td class="source"> lboth = events.both.length;</td></tr><tr class="hit"> <td class="line">83</td><td class="hits">10</td><td class="source"> emitError = lerror || (!lerror &amp;&amp; !lboth);</td></tr><tr class="hit"> <td class="line">84</td><td class="hits">10</td><td class="source"> _ref = events.error;</td></tr><tr class="hit"> <td class="line">85</td><td class="hits">10</td><td class="source"> for (_i = 0, _len = _ref.length; _i &lt; _len; _i++) {</td></tr><tr class="hit"> <td class="line">86</td><td class="hits">8</td><td class="source"> emit = _ref[_i];</td></tr><tr class="hit"> <td class="line">87</td><td class="hits">8</td><td class="source"> if (emitError) {</td></tr><tr class="hit"> <td class="line">88</td><td class="hits">8</td><td class="source"> emit.apply(null, args);</td></tr><tr><td class="line">89</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">90</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">91</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">92</td><td class="hits">42</td><td class="source"> args = [];</td></tr><tr class="hit"> <td class="line">93</td><td class="hits">42</td><td class="source"> _ref1 = events.end;</td></tr><tr class="hit"> <td class="line">94</td><td class="hits">42</td><td class="source"> for (_j = 0, _len1 = _ref1.length; _j &lt; _len1; _j++) {</td></tr><tr class="hit"> <td class="line">95</td><td class="hits">36</td><td class="source"> emit = _ref1[_j];</td></tr><tr class="hit"> <td class="line">96</td><td class="hits">36</td><td class="source"> emit();</td></tr><tr><td class="line">97</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">98</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">99</td><td class="hits">52</td><td class="source"> _ref2 = events.both;</td></tr><tr class="hit"> <td class="line">100</td><td class="hits">52</td><td class="source"> for (_k = 0, _len2 = _ref2.length; _k &lt; _len2; _k++) {</td></tr><tr class="hit"> <td class="line">101</td><td class="hits">13</td><td class="source"> emit = _ref2[_k];</td></tr><tr class="hit"> <td class="line">102</td><td class="hits">13</td><td class="source"> emit.apply(null, args);</td></tr><tr><td class="line">103</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">104</td><td class="hits">52</td><td class="source"> return;</td></tr><tr><td class="line">105</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">106</td><td class="hits">16636</td><td class="source"> if (errors.length !== 0) {</td></tr><tr class="hit"> <td class="line">107</td><td class="hits">10</td><td class="source"> return;</td></tr><tr><td class="line">108</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">109</td><td class="hits">16626</td><td class="source"> while ((parallel === true ? (eacher.total * times - eacher.started) &gt; 0 : Math.min(parallel - eacher.started + eacher.done, eacher.total * times - eacher.started))) {</td></tr><tr class="hit"> <td class="line">110</td><td class="hits">16670</td><td class="source"> if (errors.length !== 0) {</td></tr><tr class="hit"> <td class="line">111</td><td class="hits">9</td><td class="source"> break;</td></tr><tr><td class="line">112</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">113</td><td class="hits">16661</td><td class="source"> index = Math.floor(eacher.started / times);</td></tr><tr class="hit"> <td class="line">114</td><td class="hits">16661</td><td class="source"> eacher.started++;</td></tr><tr class="hit"> <td class="line">115</td><td class="hits">16661</td><td class="source"> try {</td></tr><tr class="hit"> <td class="line">116</td><td class="hits">16661</td><td class="source"> _ref3 = events.item;</td></tr><tr class="hit"> <td class="line">117</td><td class="hits">16661</td><td class="source"> for (_l = 0, _len3 = _ref3.length; _l &lt; _len3; _l++) {</td></tr><tr class="hit"> <td class="line">118</td><td class="hits">16661</td><td class="source"> emit = _ref3[_l];</td></tr><tr class="hit"> <td class="line">119</td><td class="hits">16661</td><td class="source"> switch (emit.length) {</td></tr><tr><td class="line">120</td><td class="hits"></td><td class="source"> case 1:</td></tr><tr class="hit"> <td class="line">121</td><td class="hits">6</td><td class="source"> args = [next];</td></tr><tr class="hit"> <td class="line">122</td><td class="hits">6</td><td class="source"> break;</td></tr><tr><td class="line">123</td><td class="hits"></td><td class="source"> case 2:</td></tr><tr class="hit"> <td class="line">124</td><td class="hits">6</td><td class="source"> if (keys) {</td></tr><tr class="hit"> <td class="line">125</td><td class="hits">3</td><td class="source"> args = [elements[keys[index]], next];</td></tr><tr><td class="line">126</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">127</td><td class="hits">3</td><td class="source"> args = [elements[index], next];</td></tr><tr><td class="line">128</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">129</td><td class="hits">6</td><td class="source"> break;</td></tr><tr><td class="line">130</td><td class="hits"></td><td class="source"> case 3:</td></tr><tr class="hit"> <td class="line">131</td><td class="hits">16644</td><td class="source"> if (keys) {</td></tr><tr class="hit"> <td class="line">132</td><td class="hits">27</td><td class="source"> args = [keys[index], elements[keys[index]], next];</td></tr><tr><td class="line">133</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="hit"> <td class="line">134</td><td class="hits">16617</td><td class="source"> args = [elements[index], index, next];</td></tr><tr><td class="line">135</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">136</td><td class="hits">16644</td><td class="source"> break;</td></tr><tr><td class="line">137</td><td class="hits"></td><td class="source"> case 4:</td></tr><tr class="hit"> <td class="line">138</td><td class="hits">3</td><td class="source"> if (keys) {</td></tr><tr class="hit"> <td class="line">139</td><td class="hits">3</td><td class="source"> args = [keys[index], elements[keys[index]], index, next];</td></tr><tr><td class="line">140</td><td class="hits"></td><td class="source"> } else {</td></tr><tr class="miss"> <td class="line">141</td><td class="hits">0</td><td class="source"> return next(new Error('Invalid arguments in item callback'));</td></tr><tr><td class="line">142</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">143</td><td class="hits">3</td><td class="source"> break;</td></tr><tr><td class="line">144</td><td class="hits"></td><td class="source"> default:</td></tr><tr class="hit"> <td class="line">145</td><td class="hits">2</td><td class="source"> return next(new Error('Invalid arguments in item callback'));</td></tr><tr><td class="line">146</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">147</td><td class="hits">16659</td><td class="source"> emit.apply(null, args);</td></tr><tr><td class="line">148</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">149</td><td class="hits"></td><td class="source"> } catch (e) {</td></tr><tr class="hit"> <td class="line">150</td><td class="hits">1</td><td class="source"> if (eacher.readable) {</td></tr><tr class="hit"> <td class="line">151</td><td class="hits">1</td><td class="source"> next(e);</td></tr><tr><td class="line">152</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">153</td><td class="hits"></td><td class="source"> }</td></tr><tr><td class="line">154</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">155</td><td class="hits">16624</td><td class="source"> return null;</td></tr><tr><td class="line">156</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">157</td><td class="hits">52</td><td class="source"> next = function(err) {</td></tr><tr class="hit"> <td class="line">158</td><td class="hits">16661</td><td class="source"> if ((err != null) &amp;&amp; err instanceof Error) {</td></tr><tr class="hit"> <td class="line">159</td><td class="hits">13</td><td class="source"> errors.push(err);</td></tr><tr><td class="line">160</td><td class="hits"></td><td class="source"> }</td></tr><tr class="hit"> <td class="line">161</td><td class="hits">16661</td><td class="source"> eacher.done++;</td></tr><tr class="hit"> <td class="line">162</td><td class="hits">16661</td><td class="source"> return run();</td></tr><tr><td class="line">163</td><td class="hits"></td><td class="source"> };</td></tr><tr class="hit"> <td class="line">164</td><td class="hits">52</td><td class="source"> process.nextTick(run);</td></tr><tr class="hit"> <td class="line">165</td><td class="hits">52</td><td class="source"> return eacher;</td></tr><tr><td class="line">166</td><td class="hits"></td><td class="source">};</td></tr></tbody></table></div></div></div></body></html>
Please sign in to comment.
Something went wrong with that request. Please try again.