mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-24 11:13:18 +00:00
247 lines
6.4 KiB
HTML
247 lines
6.4 KiB
HTML
|
<!doctype html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>Code coverage report for async-throttle/index.js</title>
|
||
|
<meta charset="utf-8">
|
||
|
<link rel="stylesheet" href="../prettify.css">
|
||
|
<link rel="stylesheet" href="../base.css">
|
||
|
<style type='text/css'>
|
||
|
div.coverage-summary .sorter {
|
||
|
background-image: url(../sort-arrow-sprite.png);
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="header high">
|
||
|
<h1>Code coverage report for <span class="entity">async-throttle/index.js</span></h1>
|
||
|
<h2>
|
||
|
Statements: <span class="metric">100% <small>(37 / 37)</small></span>
|
||
|
Branches: <span class="metric">92.86% <small>(13 / 14)</small></span>
|
||
|
Functions: <span class="metric">100% <small>(7 / 7)</small></span>
|
||
|
Lines: <span class="metric">100% <small>(37 / 37)</small></span>
|
||
|
Ignored: <span class="metric"><span class="ignore-none">none</span></span>
|
||
|
</h2>
|
||
|
<div class="path"><a href="../index.html">All files</a> » <a href="index.html">async-throttle/</a> » index.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</td><td class="line-coverage"><span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-yes">7</span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-yes">3</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">19</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-yes">45</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">39</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">39</span>
|
||
|
<span class="cline-any cline-yes">18</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-yes">6</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-yes">13</span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-neutral"> </span>
|
||
|
<span class="cline-any cline-yes">1</span>
|
||
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
|
||
|
|
||
|
function Queue(options) {
|
||
|
if (!(this instanceof Queue)) {
|
||
|
return new Queue(options);
|
||
|
}
|
||
|
|
||
|
options = options || {};
|
||
|
this.concurrency = options.concurrency || Infinity;
|
||
|
this.pending = 0;
|
||
|
this.jobs = [];
|
||
|
this.cbs = [];
|
||
|
this._done = done.bind(this);
|
||
|
}
|
||
|
|
||
|
var arrayAddMethods = [
|
||
|
'push',
|
||
|
'unshift',
|
||
|
'splice'
|
||
|
];
|
||
|
|
||
|
arrayAddMethods.forEach(function(method) {
|
||
|
Queue.prototype[method] = function() {
|
||
|
var methodResult = Array.prototype[method].apply(this.jobs, arguments);
|
||
|
this._run();
|
||
|
return methodResult;
|
||
|
};
|
||
|
});
|
||
|
|
||
|
Object.defineProperty(Queue.prototype, 'length', {
|
||
|
get: function() {
|
||
|
return this.pending + this.jobs.length;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Queue.prototype._run = function() {
|
||
|
if (this.pending === this.concurrency) {
|
||
|
return;
|
||
|
}
|
||
|
if (this.jobs.length) {
|
||
|
var job = this.jobs.shift();
|
||
|
this.pending++;
|
||
|
job(this._done);
|
||
|
this._run();
|
||
|
}
|
||
|
|
||
|
if (this.pending === 0) {
|
||
|
while (this.cbs.length !== 0) {
|
||
|
var cb = this.cbs.pop();
|
||
|
process.nextTick(cb);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
Queue.prototype.onDone = function(cb) {
|
||
|
<span class="missing-if-branch" title="else path not taken" >E</span>if (typeof cb === 'function') {
|
||
|
this.cbs.push(cb);
|
||
|
this._run();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function done() {
|
||
|
this.pending--;
|
||
|
this._run();
|
||
|
}
|
||
|
|
||
|
module.exports = Queue;
|
||
|
</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 Mon Sep 11 2017 11:14:14 GMT-0500 (CDT)</div>
|
||
|
</div>
|
||
|
<script src="../prettify.js"></script>
|
||
|
<script>
|
||
|
window.onload = function () {
|
||
|
if (typeof prettyPrint === 'function') {
|
||
|
prettyPrint();
|
||
|
}
|
||
|
};
|
||
|
</script>
|
||
|
<script src="../sorter.js"></script>
|
||
|
</body>
|
||
|
</html>
|