cliff
Advanced tools
Comparing version 0.1.9 to 0.1.10
/* | ||
* put-object.js: Example usage for `cliff.putObject`. | ||
* | ||
* (C) 2010, Nodejitsu Inc. | ||
* (C) 2010, Charlie Robbins & the Contributors | ||
* | ||
*/ | ||
var cliff = require('../lib/cliff'); | ||
@@ -9,0 +9,0 @@ |
/* | ||
* put-object-rows.js: Example usage for `cliff.putObjectRows`. | ||
* | ||
* (C) 2010, Nodejitsu Inc. | ||
* (C) 2010, Charlie Robbins & the Contributors | ||
* | ||
*/ | ||
var cliff = require('../lib/cliff'); | ||
@@ -9,0 +9,0 @@ |
/* | ||
* put-object.js: Example usage for `cliff.putObject`. | ||
* | ||
* (C) 2010, Nodejitsu Inc. | ||
* (C) 2010, Charlie Robbins & the Contributors | ||
* | ||
*/ | ||
var cliff = require('../lib/cliff'); | ||
@@ -9,0 +9,0 @@ |
/* | ||
* put-object-rows.js: Example usage for `cliff.putObjectRows`. | ||
* | ||
* (C) 2010, Nodejitsu Inc. | ||
* (C) 2010, Charlie Robbins & the Contributors | ||
* | ||
*/ | ||
var cliff = require('../lib/cliff'); | ||
@@ -9,0 +9,0 @@ |
/* | ||
* cliff.js: CLI output formatting tools: "Your CLI Formatting Friend". | ||
* | ||
* (C) 2010, Nodejitsu Inc. | ||
* (C) 2010, Charlie Robbins & the Contributors | ||
* | ||
*/ | ||
var colors = require('colors'), | ||
@@ -22,3 +22,3 @@ eyes = require('eyes'), | ||
logger = val; | ||
// | ||
@@ -58,3 +58,3 @@ // Setup winston to use the `cli` formats | ||
// ### function extractFrom (obj, properties) | ||
// #### @obj {Object} Object to extract properties from. | ||
// #### @obj {Object} Object to extract properties from. | ||
// #### @properties {Array} List of properties to output. | ||
@@ -77,3 +77,3 @@ // Creates an array representing the values for `properties` in `obj`. | ||
var columns = []; | ||
rows.forEach(function (row) { | ||
@@ -84,7 +84,7 @@ for (var i = 0; i < row.length; i += 1) { | ||
} | ||
columns[i].push(row[i]); | ||
} | ||
}); | ||
return columns; | ||
@@ -94,6 +94,6 @@ }; | ||
// | ||
// ### arrayLengths (arrs) | ||
// ### arrayLengths (arrs) | ||
// #### @arrs {ArrayxArray} Arrays to calculate lengths for | ||
// Creates an array with values each representing the length | ||
// of an array in the set provided. | ||
// of an array in the set provided. | ||
// | ||
@@ -137,6 +137,6 @@ cliff.arrayLengths = function (arrs) { | ||
} | ||
output.push(rowtext); | ||
} | ||
// If we were passed colors, then assume the first row | ||
@@ -148,7 +148,7 @@ // is the headers for the rows | ||
} | ||
rows.forEach(function (row) { | ||
stringifyRow(row, false); | ||
}); | ||
return output.join('\n'); | ||
@@ -169,3 +169,3 @@ }; | ||
})); | ||
return cliff.stringifyRows(rows, colors, options); | ||
@@ -175,3 +175,3 @@ }; | ||
// | ||
// ### function putRows (level, rows, colors) | ||
// ### function putRows (level, rows, colors) | ||
// #### @level {String} Log-level to use | ||
@@ -190,3 +190,3 @@ // #### @rows {Array} Array of rows to log at the specified level | ||
// | ||
// ### function putObjectRows (level, rows, colors) | ||
// ### function putObjectRows (level, rows, colors) | ||
// #### @level {String} Log-level to use | ||
@@ -211,3 +211,3 @@ // #### @objs {Array} List of objects to create output for | ||
// Inspects the object `obj` on the command line rewriting any properties which match | ||
// keys in `rewriters` if any. Adds additional `padding` if supplied. | ||
// keys in `rewriters` if any. Adds additional `padding` if supplied. | ||
// | ||
@@ -220,9 +220,9 @@ cliff.putObject = function (/*obj, [rewriters, padding] */) { | ||
keys = Object.keys(obj).sort(), | ||
sorted = {}, | ||
sorted = {}, | ||
matchers = {}, | ||
inspected; | ||
padding = padding || 0; | ||
rewriters = rewriters || {}; | ||
function pad () { | ||
@@ -233,13 +233,13 @@ for (var i = 0; i < padding / 2; i++) { | ||
} | ||
keys.forEach(function (key) { | ||
sorted[key] = obj[key]; | ||
}); | ||
inspected = cliff.inspect(sorted); | ||
Object.keys(rewriters).forEach(function (key) { | ||
matchers[key] = new RegExp(key); | ||
}); | ||
pad(); | ||
@@ -274,11 +274,11 @@ inspected.split('\n').forEach(function (line) { | ||
types.forEach(function (t) { | ||
if (value instanceof t) { | ||
if (value instanceof t) { | ||
s = t.name.toLowerCase(); | ||
} | ||
}); | ||
} else { | ||
} else { | ||
s = 'null'; | ||
} | ||
} | ||
return s; | ||
@@ -285,0 +285,0 @@ }; |
{ | ||
"name": "cliff", | ||
"description": "Your CLI formatting friend.", | ||
"version": "0.1.9", | ||
"author": "Nodejitsu Inc. <info@nodejitsu.com>", | ||
"version": "0.1.10", | ||
"author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
"repository": { | ||
@@ -10,5 +10,2 @@ "type": "git", | ||
}, | ||
"maintainers": [ | ||
"indexzero <charlie@nodejitsu.com>" | ||
], | ||
"keywords": [ | ||
@@ -21,8 +18,8 @@ "cli", | ||
"dependencies": { | ||
"colors": "0.x.x", | ||
"eyes": "0.1.x", | ||
"colors": "~1.0.3", | ||
"eyes": "~0.1.8", | ||
"winston": "0.8.x" | ||
}, | ||
"devDependencies": { | ||
"vows": "0.7.x" | ||
"vows": "0.8.x" | ||
}, | ||
@@ -29,0 +26,0 @@ "main": "./lib/cliff", |
/* | ||
* log-test.js: Tests for cliff. | ||
* | ||
* (C) 2010, Nodejitsu Inc. | ||
* (C) 2010, Charlie Robbins & the Contributors | ||
* | ||
*/ | ||
var assert = require('assert'), | ||
@@ -12,3 +12,3 @@ vows = require('vows'), | ||
cliff = require('../lib/cliff'); | ||
vows.describe('cliff').addBatch({ | ||
@@ -23,3 +23,3 @@ "When using cliff module": { | ||
]; | ||
columns = cliff.columnMajor(rows); | ||
@@ -73,5 +73,5 @@ for (var i = 0; i < columns.length; i++) { | ||
]; | ||
assert.equal( | ||
cliff.stringifyRows(rows), | ||
cliff.stringifyRows(rows), | ||
'a b \n12345 1 ' | ||
@@ -78,0 +78,0 @@ ); |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
255031
0
+ Addedcolors@1.0.3(transitive)
Updatedcolors@~1.0.3
Updatedeyes@~0.1.8