dependency-graph
Advanced tools
Comparing version 0.1.0 to 0.2.0
# Dependency Graph Changelog | ||
## In development | ||
## 0.2.0 (May 1, 2015) | ||
- Removed dependency on Underscore - thanks [myndzi](https://github.com/myndzi)! (Fixes #1) | ||
## 0.1.0 (May 18, 2013) | ||
- Initial Release - extracted out of asset-smasher |
/** | ||
* A simple dependency graph | ||
*/ | ||
var _ = require('underscore'); | ||
@@ -54,8 +53,8 @@ /** | ||
delete this.incomingEdges[name]; | ||
_.each(this.incomingEdges, function (edges) { | ||
var idx = edges.indexOf(name); | ||
Object.keys(this.incomingEdges).forEach(function (key) { | ||
var idx = this.incomingEdges[key].indexOf(name); | ||
if (idx >= 0) { | ||
edges.splice(idx, 1); | ||
} | ||
}); | ||
}, this); | ||
}, | ||
@@ -121,8 +120,9 @@ hasNode:function (name) { | ||
var DFS = createDFS(this.outgoingEdges, leavesOnly, result); | ||
_.each(_.filter(_.keys(this.nodes), function (node) { | ||
var keys = Object.keys(this.nodes); | ||
keys.filter(function (node) { | ||
return self.incomingEdges[node].length === 0; | ||
}), function (n) { | ||
}).forEach(function (n) { | ||
DFS(n); | ||
}); | ||
if (_.size(this.nodes) > 0 && result.length === 0) { | ||
if (keys.length > 0 && result.length === 0) { | ||
// Special case when there are no nodes with no dependants | ||
@@ -133,2 +133,2 @@ throw new Error('Dependency Cycle Found'); | ||
} | ||
}; | ||
}; |
{ | ||
"name": "dependency-graph", | ||
"description": "Simple dependency graph.", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"author": "Jim Riecken <jriecken@gmail.com>", | ||
@@ -25,8 +25,6 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"underscore": "1.4.4" | ||
}, | ||
"dependencies": {}, | ||
"optionalDependencies": {}, | ||
"devDependencies": { | ||
"jasmine-node": "1.7.1" | ||
"jasmine-node": "1.14.5" | ||
}, | ||
@@ -33,0 +31,0 @@ "engines": { |
10627
0
214
- Removedunderscore@1.4.4
- Removedunderscore@1.4.4(transitive)