pretty-print
Advanced tools
Comparing version 0.3.0 to 0.3.1
16
index.js
var _ = require('lodash'); | ||
var feedback = require('feedback'); | ||
var chalk = require('chalk'); | ||
var util = require('util'); | ||
@@ -37,3 +38,16 @@ var print = module.exports = function (data, options) { | ||
feedback.info(lPad + paddedKey + JSON.stringify(data[key]).replace(/^\"|\"$/g, '')); | ||
if (util.isArray(data[key])){ | ||
var blankKey = key.replace(/./gi, ' '); // used for spacing | ||
var blankPaddedKey = addPadding(blankKey, maxKeyLen); | ||
var arr = data[key]; | ||
feedback.info(lPad + paddedKey + JSON.stringify(arr[0]).replace(/^\"|\"$/g, '')); | ||
for(var i = 1; i < arr.length; i += 1) { | ||
feedback.info(lPad + blankPaddedKey + JSON.stringify(arr[i]).replace(/^\"|\"$/g, '')); | ||
} | ||
} | ||
else{ | ||
feedback.info(lPad + paddedKey + JSON.stringify(data[key]).replace(/^\"|\"$/g, '')); | ||
} | ||
}); | ||
@@ -40,0 +54,0 @@ } |
{ | ||
"name": "pretty-print", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Print formatted data to the the command line", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,4 +20,12 @@ var print = require('../'); | ||
var data = ['name1', 'name2']; | ||
// var data = ['name1', 'name2']; | ||
data = { | ||
name: 'Scott', | ||
age: 30, | ||
emails: ['scottcorgan@gmail.com', 'scott@divshot.com', 'scott@lakeshorecitychurch.com'], | ||
wife: 'Lindsay' | ||
} | ||
print(data, { | ||
@@ -24,0 +32,0 @@ // padding: 3, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5460
123