Skip to content

Commit

Permalink
Fix bug: Remove self from list of dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
timoxley committed Jan 26, 2015
1 parent 5bb7c00 commit f1e3973
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ function getDependencies(mod, result, visited, depth) {
var dependencies = mod.dependencies || []
Object.keys(dependencies).forEach(name => {
var dep = mod.dependencies[name]
if (dep === mod) return
if (dep === mod) {
delete mod.dependencies[name]
return
}
if (typeof dep === 'string') return
if (visited[dep.realPath]) return
visited[dep.realPath] = true
Expand Down
5 changes: 4 additions & 1 deletion installed.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ function getDependencies(mod, result, visited, depth) {
var dependencies = mod.dependencies || [];
Object.keys(dependencies).forEach(function (name) {
var dep = mod.dependencies[name];
if (dep === mod) return;
if (dep === mod) {
delete mod.dependencies[name];
return;
}
if (typeof dep === "string") return;
if (visited[dep.realPath]) return;
visited[dep.realPath] = true;
Expand Down

0 comments on commit f1e3973

Please sign in to comment.