travis-ci
1167 of 1464 branches covered (79.71%)
25 of 25 new or added lines in 4 files covered. (100.0%)
3103 of 3325 relevant lines covered (93.32%)
492.03 hits per line
1 |
|
|
2 |
/**
|
|
3 |
* @method graph.map |
|
4 |
*/ |
|
5 |
module.exports = function(graph, name, callback){ |
4✔ |
6 |
var deps = {};
|
42 all except 3249.4 ✔ |
7 |
var out = [];
|
42 all except 3249.4 ✔ |
8 |
|
|
9 |
function visit(name, node) { |
4✔ |
10 |
if(!deps[name]) {
|
|
11 |
deps[name] = true;
|
84 all except 3249.4 ✔ |
12 |
|
|
13 |
var result = callback(name, node);
|
84 all except 3249.4 ✔ |
14 |
out.push(result); |
84 all except 3249.4 ✔ |
15 |
} |
|
16 |
|
|
17 |
if(node.dependencies.length) {
|
|
18 |
node.dependencies.forEach(function(name){
|
42 all except 3249.4 ✔ |
19 |
visit(name, graph[name]); |
42 all except 3249.4 ✔ |
20 |
}); |
|
21 |
} |
|
22 |
} |
|
23 |
|
|
24 |
// It's possible weren't try to map a node that doesn't exist.
|
|
25 |
if(graph[name]) {
|
|
26 |
visit(name, graph[name]); |
42 all except 3249.4 ✔ |
27 |
} |
|
28 |
|
|
29 |
return out;
|
42 all except 3249.4 ✔ |
30 |
}; |