Skip to content

Commit

Permalink
Use wu for filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
davedoesdev committed Feb 20, 2017
1 parent 85201a9 commit ac630e7
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 318 deletions.
2 changes: 1 addition & 1 deletion coverage/coverage.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions coverage/lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ <h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>128/128</span>
<span class='fraction'>121/121</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>75/75</span>
<span class='fraction'>71/71</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
Expand All @@ -37,7 +37,7 @@ <h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>128/128</span>
<span class='fraction'>121/121</span>
</div>
</div>
</div>
Expand All @@ -62,13 +62,13 @@ <h1>
<td class="file high" data-value="mqlobber-access-control/"><a href="mqlobber-access-control/index.html">mqlobber-access-control/</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="128" class="abs high">128/128</td>
<td data-value="121" class="abs high">121/121</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="75" class="abs high">75/75</td>
<td data-value="71" class="abs high">71/71</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="15" class="abs high">15/15</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="128" class="abs high">128/128</td>
<td data-value="121" class="abs high">121/121</td>
</tr>

</tbody>
Expand All @@ -77,7 +77,7 @@ <h1>
</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 Sat Feb 11 2017 22:24:40 GMT+0000 (GMT)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Feb 20 2017 08:09:40 GMT+0000 (GMT)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
14 changes: 7 additions & 7 deletions coverage/lcov-report/mqlobber-access-control/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ <h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>128/128</span>
<span class='fraction'>121/121</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>75/75</span>
<span class='fraction'>71/71</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
Expand All @@ -37,7 +37,7 @@ <h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>128/128</span>
<span class='fraction'>121/121</span>
</div>
</div>
</div>
Expand All @@ -62,13 +62,13 @@ <h1>
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="128" class="abs high">128/128</td>
<td data-value="121" class="abs high">121/121</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="75" class="abs high">75/75</td>
<td data-value="71" class="abs high">71/71</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="15" class="abs high">15/15</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="128" class="abs high">128/128</td>
<td data-value="121" class="abs high">121/121</td>
</tr>

</tbody>
Expand All @@ -77,7 +77,7 @@ <h1>
</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 Sat Feb 11 2017 22:24:40 GMT+0000 (GMT)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Feb 20 2017 08:09:40 GMT+0000 (GMT)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
79 changes: 11 additions & 68 deletions coverage/lcov-report/mqlobber-access-control/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ <h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>128/128</span>
<span class='fraction'>121/121</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>75/75</span>
<span class='fraction'>71/71</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
Expand All @@ -37,7 +37,7 @@ <h1>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>128/128</span>
<span class='fraction'>121/121</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -602,26 +602,7 @@ <h1>
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
560</td><td class="line-coverage quiet"><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>
Expand Down Expand Up @@ -831,17 +812,17 @@ <h1>
<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"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">380×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">380×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">91×</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">289×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2457×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -856,25 +837,6 @@ <h1>
<span class="cline-any cline-yes">2433×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">289×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">186×</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">103×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">103×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">827×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">815×</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">289×</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-neutral">&nbsp;</span>
Expand Down Expand Up @@ -1405,21 +1367,21 @@ <h1>
&nbsp;
var EventEmitter = require('events').EventEmitter,
util = require('util'),
wu = require('wu'),
Transform = require('stream').Transform,
QlobberDedup = require('qlobber').QlobberDedup,
blocked_matcher = new QlobberDedup();
&nbsp;
function filter(info, handlers, cb)
{
var blocked_handlers = blocked_matcher.match(info.topic),
new_handlers;
var blocked_handlers = blocked_matcher.match(info.topic);
&nbsp;
if (blocked_handlers.size === 0)
{
return cb(null, true, handlers);
}
&nbsp;
function allow(handler)
cb(null, true, wu(handlers).filter(function (handler)
{
if (blocked_handlers.has(handler))
{
Expand All @@ -1432,26 +1394,7 @@ <h1>
}
&nbsp;
return true;
}
&nbsp;
if (Array.isArray(handlers))
{
new_handlers = handlers.filter(allow);
}
else
{
new_handlers = new Set();
&nbsp;
for (var handler of handlers)
{
if (allow(handler))
{
new_handlers.add(handler);
}
}
}
&nbsp;
cb(null, true, new_handlers);
}));
}
&nbsp;
function allow(matchers, topic)
Expand Down Expand Up @@ -1783,7 +1726,7 @@ <h1>
</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 Sat Feb 11 2017 22:24:40 GMT+0000 (GMT)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Feb 20 2017 08:09:40 GMT+0000 (GMT)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
Loading

0 comments on commit ac630e7

Please sign in to comment.