diff options
Diffstat (limited to 'lib/ls.js')
-rw-r--r-- | lib/ls.js | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -60,8 +60,7 @@ var lsFromTree = ls.fromTree = function (dir, physicalTree, args, silent, cb) { var p = npa(a) var name = p.name var ver = semver.validRange(p.rawSpec) || '' - - return [ name, ver ] + return [ name, ver, a ] }) } @@ -280,15 +279,20 @@ function filterFound (root, args) { if (!args.length) return root var deps = root.dependencies if (deps) { - Object.keys(deps).forEach(function (d) { - var dep = filterFound(deps[d], args) + Object.keys(deps).forEach(function (depName) { + var dep = filterFound(deps[depName], args) if (dep.peerMissing) return // see if this one itself matches var found = false - for (var i = 0; !found && i < args.length; i++) { - if (d === args[i][0]) { - found = semver.satisfies(dep.version, args[i][1], true) + for (var ii = 0; !found && ii < args.length; ii++) { + var argName = args[ii][0] + var argVersion = args[ii][1] + var argRaw = args[ii][2] + if (depName === argName) { + found = semver.satisfies(dep.version, argVersion, true) + } else if (dep.path === argRaw) { + found = true } } // included explicitly @@ -296,7 +300,7 @@ function filterFound (root, args) { // included because a child was included if (dep._found && !root._found) root._found = 1 // not included - if (!dep._found) delete deps[d] + if (!dep._found) delete deps[depName] }) } if (!root._found) root._found = false |