@quarterto/transitive-dependencies
Version:
13 lines (12 loc) • 341 B
JavaScript
var Set = require('es6-set');
var arrayFrom = require('array-from');
module.exports = function transitiveDependencies(edges, start, out) {
out = out || new Set();
edges.forEach(function(edge) {
if(edge[0] === start) {
out.add(edge[1]);
transitiveDependencies(edges, edge[1], out);
}
});
return arrayFrom(out);
};