summaryrefslogtreecommitdiff
path: root/deps/npm/lib/view.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/view.js')
-rw-r--r--deps/npm/lib/view.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/deps/npm/lib/view.js b/deps/npm/lib/view.js
index 592d83d4cc..b88f98a095 100644
--- a/deps/npm/lib/view.js
+++ b/deps/npm/lib/view.js
@@ -189,7 +189,12 @@ function printData (data, name, cb) {
fields.forEach(function (f) {
var d = cleanup(data[v][f])
if (showVersions || showFields || typeof d !== "string") {
- d = util.inspect(cleanup(data[v][f]), false, 5, npm.color)
+ d = cleanup(data[v][f])
+ d = npm.config.get("json")
+ ? JSON.stringify(d, null, 2)
+ : util.inspect(d, false, 5, npm.color)
+ } else if (typeof d === "string" && npm.config.get("json")) {
+ d = JSON.stringify(d)
}
if (f && showFields) f += " = "
if (d.indexOf("\n") !== -1) d = "\n" + d