column-layout
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -20,2 +20,6 @@ 'use strict'; | ||
var ttyWidth = process && (process.stdout.columns || process.stderr.columns) || 0; | ||
if (ttyWidth && os.platform() === 'win32') ttyWidth--; | ||
var defaults = { | ||
@@ -26,7 +30,7 @@ padding: { | ||
}, | ||
viewWidth: process && process.stdout.columns || 80, | ||
viewWidth: ttyWidth || 80, | ||
columns: [] | ||
}; | ||
_options.set(this, extend(defaults, options)); | ||
this.load(data); | ||
@@ -86,3 +90,3 @@ } | ||
line.push(wrap.lines(cell.value, { | ||
width: column.generatedWidth - column.padding.length(), | ||
width: column.wrappedContentWidth, | ||
ignore: ansi.regexp, | ||
@@ -89,0 +93,0 @@ 'break': column['break'] |
@@ -22,3 +22,3 @@ 'use strict' | ||
@param [options.nowrap] {boolean} - disable wrapping on all columns | ||
@param [options.break] {boolean} - enable breaking on all columns | ||
@param [options.break] {boolean} - enable word-breaking on all columns | ||
@param [options.columns] {module:column-layout~columnOption} - array of column options | ||
@@ -72,5 +72,6 @@ @param [options.padding] {object} - Padding values to set on each column. Per-column overrides can be set in the `options.columns` array. | ||
* @property [width] {number} - column width | ||
* @property [minWidth] {number} - column min width | ||
* @property [maxWidth] {number} - column max width | ||
* @property [nowrap] {boolean} - disable wrapping for this column | ||
* @property [break] {boolean} - enable breaking on all columns | ||
* @property [break] {boolean} - enable word-breaking for this columns | ||
* @property [padding] {object} - padding options | ||
@@ -77,0 +78,0 @@ * @property [padding.left] {string} - a string to pad the left of each cell (default: `" "`) |
@@ -109,8 +109,5 @@ 'use strict' | ||
/* need a minWidth to stop breakable columns getting too short */ | ||
/* if, after autosizing, we still don't fit within viewWidth then give up */ | ||
} | ||
// console.log(this); | ||
return this | ||
@@ -117,0 +114,0 @@ } |
@@ -19,3 +19,2 @@ 'use strict' | ||
load (rows, columns) { | ||
// arrayify(rows).forEach(row => this.push(new Row(row, columns))) | ||
arrayify(rows).forEach(row => this.push(new Map(objectToIterable(row, columns)))) | ||
@@ -56,8 +55,2 @@ } | ||
// class Row extends Map { | ||
// constructor (row, columns) { | ||
// super(objectToIterable(row, columns)) | ||
// } | ||
// } | ||
function getLongestWord (line) { | ||
@@ -64,0 +57,0 @@ const words = wrap.getWords(line) |
@@ -17,2 +17,7 @@ 'use strict' | ||
constructor (data, options) { | ||
let ttyWidth = (process && (process.stdout.columns || process.stderr.columns)) || 0 | ||
/* Windows quirk workaround */ | ||
if (ttyWidth && os.platform() === 'win32') ttyWidth-- | ||
let defaults = { | ||
@@ -23,7 +28,7 @@ padding: { | ||
}, | ||
viewWidth: (process && process.stdout.columns) || 80, | ||
viewWidth: ttyWidth || 80, | ||
columns: [] | ||
} | ||
_options.set(this, extend(defaults, options)) | ||
this.load(data) | ||
@@ -83,3 +88,3 @@ } | ||
line.push(wrap.lines(cell.value, { | ||
width: column.generatedWidth - column.padding.length(), | ||
width: column.wrappedContentWidth, | ||
ignore: ansi.regexp, | ||
@@ -86,0 +91,0 @@ break: column.break |
{ | ||
"name": "column-layout", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Pretty-print JSON data in columns.", | ||
@@ -25,3 +25,3 @@ "repository": "https://github.com/75lb/column-layout.git", | ||
"docs": "jsdoc2md -t jsdoc2md/README.hbs lib/*.js > README.md; echo", | ||
"es5": "babel --presets es2015 --no-comments lib --out-dir es5", | ||
"es5": "babel --no-comments lib --out-dir es5", | ||
"cover": "istanbul cover tape -- test/*.js && cat coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf coverage; echo" | ||
@@ -42,3 +42,3 @@ }, | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.0.15", | ||
"babel": "^5.8.34", | ||
"coveralls": "^2.11.4", | ||
@@ -45,0 +45,0 @@ "jsdoc-to-markdown": "^1.1.1", |
[![view on npm](http://img.shields.io/npm/v/column-layout.svg)](https://www.npmjs.org/package/column-layout) | ||
[![npm module downloads](http://img.shields.io/npm/dt/column-layout.svg)](https://www.npmjs.org/package/column-layout) | ||
[![Build Status](https://travis-ci.org/75lb/column-layout.svg?branch=master)](https://travis-ci.org/75lb/column-layout) | ||
[![Coverage Status](https://coveralls.io/repos/75lb/column-layout/badge.svg?branch=master&service=github)](https://coveralls.io/github/75lb/column-layout?branch=master) | ||
[![Dependency Status](https://david-dm.org/75lb/column-layout.svg)](https://david-dm.org/75lb/column-layout) | ||
@@ -9,3 +8,3 @@ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) | ||
# column-layout | ||
Pretty-print JSON data in columns. | ||
Pretty-print text data in columns. | ||
@@ -68,30 +67,29 @@ ## Synopsis | ||
## More Examples | ||
Read the latest npm issues: | ||
Read the latest npm issues: (example requires [jq](https://stedolan.github.io/jq/)) | ||
```sh | ||
$ curl -s https://api.github.com/repos/npm/npm/issues \ | ||
| array-tools pick number title updated_at user.login comments \ | ||
| jq 'map({ number, title, login:.user.login, comments })' \ | ||
| column-layout | ||
``` | ||
``` | ||
8738 install: Run the "install" 2015-06-27T22:19:33Z iarna | ||
lifecycle in the toplevel module | ||
8737 npm install (-g) (everything) 2015-06-27T22:15:52Z DerekFoulk 2 | ||
completely broken after upgrade | ||
to 2.12.0 [Windows] | ||
8736 node-gyp not executed on npm@3 2015-06-27T22:19:19Z piranna 2 | ||
8735 Graceful fs 4 2015-06-27T21:12:57Z isaacs | ||
8734 npm start failed dont get why its 2015-06-27T21:12:36Z kashikhan1 | ||
happened error windows_nt | ||
6.3.9600 error on npm start | ||
8733 npm install error "elliptic curve 2015-06-27T21:07:15Z MF-Bra | ||
routines" | ||
8732 No clue what do 2015-06-27T20:05:26Z worldlynx | ||
8731 npm does not work on IPv6 2015-06-27T17:33:10Z hobarrera | ||
8730 Pass module version on preversion 2015-06-27T17:11:57Z zanona | ||
and postversion scripts. | ||
8729 problem installing cordova on 2015-06-27T14:28:35Z axtens | ||
Windows | ||
8728 npm error 2015-06-27T14:20:42Z hyguyz | ||
8727 npm install error 2015-06-27T13:40:56Z wfgenius | ||
8726 Why can't I install the npm? 2015-06-27T17:37:51Z PleasantPro 2 | ||
10263 npm run start Slepperpon 4 | ||
10262 npm-shrinkwrap.json being ignored for a dependency of a maxkorp 0 | ||
dependency (2.14.9, 3.3.10) | ||
10261 EPROTO Error Installing Packages azkaiart 2 | ||
10260 ENOENT during npm install with npm v3.3.6/v3.3.12 and lencioni 2 | ||
node v5.0.0 | ||
10259 npm install failed geraldvillorente 1 | ||
10258 npm moves common dependencies under a dependency on trygveaa 2 | ||
install | ||
10257 [NPM3] Missing top level dependencies after npm install naholyr 0 | ||
10256 Yo meanjs app creation problem nrjkumar41 0 | ||
10254 sapnwrfc is not installing RamprasathS 0 | ||
10253 npm install deep dependence folder "node_modules" duyetvv 2 | ||
10251 cannot npm login w0ps 2 | ||
10250 Update npm-team.md louislarry 0 | ||
10248 cant install module I created nousacademy 4 | ||
10247 Cannot install passlib nicola883 3 | ||
10246 Error installing Gulp AlanIsrael0 1 | ||
10245 cannot install packages through NPM RoyGeagea 11 | ||
10244 Remove arguments from npm-dedupe.md bengotow 0 | ||
etc. | ||
@@ -134,3 +132,3 @@ etc. | ||
| [options.nowrap] | <code>boolean</code> | disable wrapping on all columns | | ||
| [options.break] | <code>boolean</code> | enable breaking on all columns | | ||
| [options.break] | <code>boolean</code> | enable word-breaking on all columns | | ||
| [options.columns] | <code>[columnOption](#module_column-layout--columnLayout..columnOption)</code> | array of column options | | ||
@@ -177,5 +175,6 @@ | [options.padding] | <code>object</code> | Padding values to set on each column. Per-column overrides can be set in the `options.columns` array. | | ||
| width | <code>number</code> | column width | | ||
| minWidth | <code>number</code> | column min width | | ||
| maxWidth | <code>number</code> | column max width | | ||
| nowrap | <code>boolean</code> | disable wrapping for this column | | ||
| break | <code>boolean</code> | enable breaking on all columns | | ||
| break | <code>boolean</code> | enable word-breaking for this columns | | ||
| padding | <code>object</code> | padding options | | ||
@@ -182,0 +181,0 @@ | padding.left | <code>string</code> | a string to pad the left of each cell (default: `" "`) | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
94757
2050
184