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 |
var isString = require("lodash/isString"); |
4✔ |
2 |
|
|
3 |
/**
|
|
4 |
* @method graph.each |
|
5 |
*/ |
|
6 |
module.exports = function(graph, names, callback){ |
4✔ |
7 |
var deps = {};
|
18 all except 3249.4 ✔ |
8 |
var nodeNames = isString(names) ? [names] : names;
|
|
9 |
|
|
10 |
function visit(name, node) { |
4✔ |
11 |
if(!deps[name]) {
|
|
12 |
deps[name] = true;
|
42 all except 3249.4 ✔ |
13 |
|
|
14 |
// Call the callback
|
|
15 |
callback(name, node); |
42 all except 3249.4 ✔ |
16 |
|
|
17 |
if (node && node.dependencies.length) {
|
|
18 |
node.dependencies.forEach(function(name){
|
21 all except 3249.4 ✔ |
19 |
visit(name, graph[name]); |
30 all except 3249.4 ✔ |
20 |
}); |
|
21 |
} |
|
22 |
} |
|
23 |
} |
|
24 |
|
|
25 |
// It's possible weren't try to map a node that doesn't exist.
|
|
26 |
nodeNames.forEach(function(name){
|
18 all except 3249.4 ✔ |
27 |
if(graph[name]) {
|
|
28 |
visit(name, graph[name]); |
18 all except 3249.4 ✔ |
29 |
} |
|
30 |
}); |
|
31 |
}; |