diff options
Diffstat (limited to 'lib/ls.js')
-rw-r--r-- | lib/ls.js | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -139,13 +139,14 @@ function isCruft (data) { return data.extraneous && data.error && data.error.code === 'ENOTDIR' } -function getLite (data, noname) { +function getLite (data, noname, depth) { var lite = {} if (isCruft(data)) return lite var maxDepth = npm.config.get('depth') + if (typeof depth === 'undefined') depth = 0 if (!noname && data.name) lite.name = data.name if (data.version) lite.version = data.version if (data.extraneous) { @@ -213,6 +214,9 @@ function getLite (data, noname) { lite.problems.push(pdm) }) return [d, { required: dep, peerMissing: true }] + } else if (npm.config.get('json')) { + if (depth === maxDepth) delete dep.dependencies + return [d, getLite(dep, true, depth + 1)] } return [d, getLite(dep, true)] }).reduce(function (deps, d) { |