Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForrest L Norvell <forrest@npmjs.com>2015-04-10 16:21:15 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-04-10 16:21:15 +0300
commit2aecc6f4083526feeb14615b4e5484edc66175b5 (patch)
tree2a433b4454ce591d84cf82081c6b637efb2300f9 /node_modules/columnify
parent87671131cfc448796bb155a3a01254f2720bda3a (diff)
columnify@1.5.1
Switch to using babel from 6to5.
Diffstat (limited to 'node_modules/columnify')
-rw-r--r--node_modules/columnify/Makefile2
-rw-r--r--node_modules/columnify/Readme.md14
-rw-r--r--node_modules/columnify/columnify.js82
-rw-r--r--node_modules/columnify/index.js6
l---------node_modules/columnify/node_modules/.bin/strip-ansi1
-rw-r--r--node_modules/columnify/node_modules/wcwidth/node_modules/defaults/LICENSE21
-rw-r--r--node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md2
-rw-r--r--node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json3
-rw-r--r--node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json29
-rw-r--r--node_modules/columnify/node_modules/wcwidth/package.json3
-rw-r--r--node_modules/columnify/package.json30
11 files changed, 118 insertions, 75 deletions
diff --git a/node_modules/columnify/Makefile b/node_modules/columnify/Makefile
index 3ae543a94..3a67c57a3 100644
--- a/node_modules/columnify/Makefile
+++ b/node_modules/columnify/Makefile
@@ -4,6 +4,6 @@ all: columnify.js
prepublish: all
columnify.js: index.js package.json
- 6to5 index.js > columnify.js
+ babel index.js > columnify.js
.PHONY: all prepublish
diff --git a/node_modules/columnify/Readme.md b/node_modules/columnify/Readme.md
index b2b846f36..4a37928a7 100644
--- a/node_modules/columnify/Readme.md
+++ b/node_modules/columnify/Readme.md
@@ -1,6 +1,9 @@
# columnify
-[![Build Status](https://travis-ci.org/timoxley/columnify.png?branch=master)](https://travis-ci.org/timoxley/columnify)
+[![NPM](https://nodei.co/npm/columnify.png?downloads=true&downloadRank=true&stars=true&chrome)](https://nodei.co/npm-dl/columnify/)
+[![NPM](https://nodei.co/npm-dl/columnify.png?months=3&height=3&chrome)](https://nodei.co/npm/columnify/)
+
+[![Build Status](https://img.shields.io/travis/timoxley/columnify.svg?style=flat)](https://travis-ci.org/timoxley/columnify)
[![NPM Version](https://img.shields.io/npm/v/columnify.svg?style=flat)](https://npmjs.org/package/columnify)
[![License](http://img.shields.io/npm/l/columnify.svg?style=flat)](LICENSE)
[![Dependency Status](https://david-dm.org/timoxley/columnify.svg)](https://david-dm.org/timoxley/columnify)
@@ -366,6 +369,15 @@ var columns = columnify(data, {
})
```
+This also works well for hiding a single column header, like an `id` column:
+```javascript
+var columns = columnify(data, {
+ config: {
+ id: { showHeaders: false }
+ }
+})
+```
+
### Transforming Column Data and Headers
If you need to modify the presentation of column content or heading content there are two useful options for doing that: `dataTransform` and `headerTransform`. Both of these take a function and need to return a valid string.
diff --git a/node_modules/columnify/columnify.js b/node_modules/columnify/columnify.js
index 548efc679..db10a0118 100644
--- a/node_modules/columnify/columnify.js
+++ b/node_modules/columnify/columnify.js
@@ -1,9 +1,10 @@
-"use strict";
+'use strict';
-var _toArray = function (arr) { return Array.isArray(arr) ? arr : Array.from(arr); };
+var _toConsumableArray = function (arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } };
-var wcwidth = require("./width");
-var _require = require("./utils");
+var wcwidth = require('./width');
+
+var _require = require('./utils');
var padRight = _require.padRight;
var padCenter = _require.padCenter;
@@ -12,23 +13,22 @@ var splitIntoLines = _require.splitIntoLines;
var splitLongWords = _require.splitLongWords;
var truncateString = _require.truncateString;
-
-var DEFAULT_HEADING_TRANSFORM = function (key) {
+var DEFAULT_HEADING_TRANSFORM = function DEFAULT_HEADING_TRANSFORM(key) {
return key.toUpperCase();
};
-var DEFAULT_DATA_TRANSFORM = function (cell, column, index) {
+var DEFAULT_DATA_TRANSFORM = function DEFAULT_DATA_TRANSFORM(cell, column, index) {
return cell;
};
var DEFAULTS = Object.freeze({
maxWidth: Infinity,
minWidth: 0,
- columnSplitter: " ",
+ columnSplitter: ' ',
truncate: false,
- truncateMarker: "…",
+ truncateMarker: '…',
preserveNewLines: false,
- paddingChr: " ",
+ paddingChr: ' ',
showHeaders: true,
headingTransform: DEFAULT_HEADING_TRANSFORM,
dataTransform: DEFAULT_DATA_TRANSFORM
@@ -37,12 +37,11 @@ var DEFAULTS = Object.freeze({
module.exports = function (items) {
var options = arguments[1] === undefined ? {} : arguments[1];
-
var columnConfigs = options.config || {};
delete options.config; // remove config so doesn't appear on every column.
var maxLineWidth = options.maxLineWidth || Infinity;
- if (maxLineWidth === "auto") maxLineWidth = process.stdout.columns || Infinity;
+ if (maxLineWidth === 'auto') maxLineWidth = process.stdout.columns || Infinity;
delete options.maxLineWidth; // this is a line control option, don't pass it to column
// Option defaults inheritance:
@@ -51,7 +50,7 @@ module.exports = function (items) {
options.config = options.config || Object.create(null);
- options.spacing = options.spacing || "\n"; // probably useless
+ options.spacing = options.spacing || '\n'; // probably useless
options.preserveNewLines = !!options.preserveNewLines;
options.showHeaders = !!options.showHeaders;
options.columns = options.columns || options.include; // alias include/columns, prefer columns if supplied
@@ -82,7 +81,7 @@ module.exports = function (items) {
column.maxWidth = Math.ceil(column.maxWidth);
column.minWidth = Math.ceil(column.minWidth);
column.truncate = !!column.truncate;
- column.align = column.align || "left";
+ column.align = column.align || 'left';
});
// sanitize data
@@ -90,15 +89,15 @@ module.exports = function (items) {
var result = Object.create(null);
columnNames.forEach(function (columnName) {
// null/undefined -> ''
- result[columnName] = item[columnName] != null ? item[columnName] : "";
+ result[columnName] = item[columnName] != null ? item[columnName] : '';
// toString everything
- result[columnName] = "" + result[columnName];
+ result[columnName] = '' + result[columnName];
if (columns[columnName].preserveNewLines) {
// merge non-newline whitespace chars
- result[columnName] = result[columnName].replace(/[^\S\n]/gmi, " ");
+ result[columnName] = result[columnName].replace(/[^\S\n]/gmi, ' ');
} else {
// merge all whitespace chars
- result[columnName] = result[columnName].replace(/\s/gmi, " ");
+ result[columnName] = result[columnName].replace(/\s/gmi, ' ');
}
});
return result;
@@ -113,7 +112,7 @@ module.exports = function (items) {
var changedKeys = Object.keys(col);
// disable default heading transform if we wrote to column.name
- if (changedKeys.indexOf("name") !== -1) {
+ if (changedKeys.indexOf('name') !== -1) {
if (column.headingTransform !== DEFAULT_HEADING_TRANSFORM) return;
column.headingTransform = function (heading) {
return heading;
@@ -131,6 +130,12 @@ module.exports = function (items) {
if (options.showHeaders) {
columnNames.forEach(function (columnName) {
var column = columns[columnName];
+
+ if (!column.showHeaders) {
+ headers[columnName] = '';
+ return;
+ }
+
headers[columnName] = column.headingTransform(column.name);
});
items.unshift(headers);
@@ -185,7 +190,6 @@ module.exports = function (items) {
}, 0);
});
-
var rows = createRows(items, columns, columnNames, options.paddingChr); // merge lines into rows
// conceive output
return rows.reduce(function (output, row) {
@@ -213,16 +217,19 @@ function createRows(items, columns, columnNames, paddingChr) {
columnNames.forEach(function (columnName) {
numLines = Math.max(numLines, item[columnName].length);
});
+
+ var _loop = function (i) {
+ row[i] = row[i] || [];
+ columnNames.forEach(function (columnName) {
+ var column = columns[columnName];
+ var val = item[columnName][i] || ''; // || '' ensures empty columns get padded
+ if (column.align === 'right') row[i].push(padLeft(val, column.width, paddingChr));else if (column.align === 'center' || column.align === 'centre') row[i].push(padCenter(val, column.width, paddingChr));else row[i].push(padRight(val, column.width, paddingChr));
+ });
+ };
+
// combine matching lines of each rows
for (var i = 0; i < numLines; i++) {
- (function (i) {
- row[i] = row[i] || [];
- columnNames.forEach(function (columnName) {
- var column = columns[columnName];
- var val = item[columnName][i] || ""; // || '' ensures empty columns get padded
- if (column.align === "right") row[i].push(padLeft(val, column.width, paddingChr));else if (column.align === "center" || column.align === "centre") row[i].push(padCenter(val, column.width, paddingChr));else row[i].push(padRight(val, column.width, paddingChr));
- });
- })(i);
+ _loop(i);
}
return row;
});
@@ -239,13 +246,14 @@ function mixin() {
args[_key] = arguments[_key];
}
- if (Object.assign) return Object.assign.apply(Object, _toArray(args));
- return ObjectAssign.apply(undefined, _toArray(args));
+ if (Object.assign) {
+ return Object.assign.apply(Object, _toConsumableArray(args));
+ }return ObjectAssign.apply(undefined, _toConsumableArray(args));
}
function ObjectAssign(target, firstSource) {
- "use strict";
- if (target === undefined || target === null) throw new TypeError("Cannot convert first argument to object");
+ 'use strict';
+ if (target === undefined || target === null) throw new TypeError('Cannot convert first argument to object');
var to = Object(target);
@@ -286,14 +294,14 @@ function endsWith(target, searchString, position) {
return lastIndex !== -1 && lastIndex === position;
}
-
function toArray(items, columnNames) {
- if (Array.isArray(items)) return items;
- var rows = [];
+ if (Array.isArray(items)) {
+ return items;
+ }var rows = [];
for (var key in items) {
var item = {};
- item[columnNames[0] || "key"] = key;
- item[columnNames[1] || "value"] = items[key];
+ item[columnNames[0] || 'key'] = key;
+ item[columnNames[1] || 'value'] = items[key];
rows.push(item);
}
return rows;
diff --git a/node_modules/columnify/index.js b/node_modules/columnify/index.js
index 781e683aa..227b41efc 100644
--- a/node_modules/columnify/index.js
+++ b/node_modules/columnify/index.js
@@ -118,6 +118,12 @@ module.exports = function(items, options = {}) {
if(options.showHeaders) {
columnNames.forEach(columnName => {
let column = columns[columnName]
+
+ if(!column.showHeaders){
+ headers[columnName] = '';
+ return;
+ }
+
headers[columnName] = column.headingTransform(column.name)
})
items.unshift(headers)
diff --git a/node_modules/columnify/node_modules/.bin/strip-ansi b/node_modules/columnify/node_modules/.bin/strip-ansi
deleted file mode 120000
index b65c9f81d..000000000
--- a/node_modules/columnify/node_modules/.bin/strip-ansi
+++ /dev/null
@@ -1 +0,0 @@
-../strip-ansi/cli.js \ No newline at end of file
diff --git a/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/LICENSE b/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/LICENSE
new file mode 100644
index 000000000..d88b07207
--- /dev/null
+++ b/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Elijah Insua
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md b/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md
index a75e72e9f..1a4a2ea9c 100644
--- a/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md
+++ b/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/README.md
@@ -40,4 +40,4 @@ Sidecases: if called with a falsy `options` value, options will be initialized t
## license
-MIT \ No newline at end of file
+[MIT](LICENSE)
diff --git a/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json b/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json
index dc56f3f19..bc8e878a5 100644
--- a/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json
+++ b/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/node_modules/clone/package.json
@@ -122,6 +122,5 @@
"tarball": "http://registry.npmjs.org/clone/-/clone-0.1.19.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/clone/-/clone-0.1.19.tgz",
- "readme": "ERROR: No README data found!"
+ "_resolved": "https://registry.npmjs.org/clone/-/clone-0.1.19.tgz"
}
diff --git a/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json b/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json
index e3ee62191..fdd074d0f 100644
--- a/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json
+++ b/node_modules/columnify/node_modules/wcwidth/node_modules/defaults/package.json
@@ -1,6 +1,6 @@
{
"name": "defaults",
- "version": "1.0.0",
+ "version": "1.0.2",
"description": "merge single level defaults over a config object",
"main": "index.js",
"scripts": {
@@ -19,20 +19,21 @@
"email": "tmpvar@gmail.com"
},
"license": "MIT",
- "readmeFilename": "README.md",
"dependencies": {
"clone": "~0.1.5"
},
"devDependencies": {
"tap": "~0.4.0"
},
- "readme": "# defaults\n\nA simple one level options merge utility\n\n## install\n\n`npm install defaults`\n\n## use\n\n```javascript\n\nvar defaults = require('defaults');\n\nvar handle = function(options, fn) {\n options = defaults(options, {\n timeout: 100\n });\n\n setTimeout(function() {\n fn(options);\n }, options.timeout);\n}\n\nhandle({ timeout: 1000 }, function() {\n // we're here 1000 ms later\n});\n\nhandle({ timeout: 10000 }, function() {\n // we're here 10s later\n});\n\n```\n\n## summary\n\nthis module exports a function that takes 2 arguments: `options` and `defaults`. When called, it overrides all of `undefined` properties in `options` with the clones of properties defined in `defaults`\n\nSidecases: if called with a falsy `options` value, options will be initialized to a new object before being merged onto.\n\n## license\n\nMIT",
- "_id": "defaults@1.0.0",
- "dist": {
- "shasum": "3ae25f44416c6c01f9809a25fcdd285912d2a6b1",
- "tarball": "http://registry.npmjs.org/defaults/-/defaults-1.0.0.tgz"
+ "gitHead": "22c57d1f87a2f03c1f9d21bd39c67db8553a0064",
+ "bugs": {
+ "url": "https://github.com/tmpvar/defaults/issues"
},
- "_npmVersion": "1.1.65",
+ "homepage": "https://github.com/tmpvar/defaults",
+ "_id": "defaults@1.0.2",
+ "_shasum": "6902e25aa047649a501e19ef9e98f3e8365c109a",
+ "_from": "defaults@>=1.0.0 <2.0.0",
+ "_npmVersion": "1.4.23",
"_npmUser": {
"name": "tmpvar",
"email": "tmpvar@gmail.com"
@@ -43,12 +44,10 @@
"email": "tmpvar@gmail.com"
}
],
- "directories": {},
- "_shasum": "3ae25f44416c6c01f9809a25fcdd285912d2a6b1",
- "_resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.0.tgz",
- "_from": "defaults@>=1.0.0 <2.0.0",
- "bugs": {
- "url": "https://github.com/tmpvar/defaults/issues"
+ "dist": {
+ "shasum": "6902e25aa047649a501e19ef9e98f3e8365c109a",
+ "tarball": "http://registry.npmjs.org/defaults/-/defaults-1.0.2.tgz"
},
- "homepage": "https://github.com/tmpvar/defaults"
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.2.tgz"
}
diff --git a/node_modules/columnify/node_modules/wcwidth/package.json b/node_modules/columnify/node_modules/wcwidth/package.json
index 49fc6f040..4744d9dc3 100644
--- a/node_modules/columnify/node_modules/wcwidth/package.json
+++ b/node_modules/columnify/node_modules/wcwidth/package.json
@@ -56,6 +56,5 @@
"shasum": "02d059ff7a8fc741e0f6b5da1e69b2b40daeca6f",
"tarball": "http://registry.npmjs.org/wcwidth/-/wcwidth-1.0.0.tgz"
},
- "_resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.0.tgz",
- "readme": "ERROR: No README data found!"
+ "_resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.0.tgz"
}
diff --git a/node_modules/columnify/package.json b/node_modules/columnify/package.json
index a27567234..195a7f092 100644
--- a/node_modules/columnify/package.json
+++ b/node_modules/columnify/package.json
@@ -1,6 +1,6 @@
{
"name": "columnify",
- "version": "1.4.1",
+ "version": "1.5.1",
"description": "Render data in text columns. supports in-column text-wrap.",
"main": "columnify.js",
"scripts": {
@@ -14,10 +14,10 @@
},
"license": "MIT",
"devDependencies": {
- "6to5": "^3.0.9",
- "chalk": "^0.5.1",
- "tap-spec": "^2.1.1",
- "tape": "^3.0.3"
+ "babel": "^5.0.10",
+ "chalk": "^1.0.0",
+ "tap-spec": "^3.0.0",
+ "tape": "^4.0.0"
},
"repository": {
"type": "git",
@@ -37,18 +37,18 @@
},
"homepage": "https://github.com/timoxley/columnify",
"dependencies": {
- "strip-ansi": "^2.0.0",
+ "strip-ansi": "^2.0.1",
"wcwidth": "^1.0.0"
},
"directories": {
"test": "test"
},
- "gitHead": "24371e9c12287ce4d28f19d704a28059f3acd42b",
- "_id": "columnify@1.4.1",
- "_shasum": "30555796379865b016189c228cb0061764270ed0",
- "_from": "columnify@>=1.4.1 <1.5.0",
- "_npmVersion": "2.3.0",
- "_nodeVersion": "0.10.35",
+ "gitHead": "1e5f5ec9478d7dbd1e3d1d74343b552da7ae01ba",
+ "_id": "columnify@1.5.1",
+ "_shasum": "15fdda803a3875f87f9d302b3bc828932d664003",
+ "_from": "columnify@>=1.5.1 <1.6.0",
+ "_npmVersion": "2.7.6",
+ "_nodeVersion": "0.10.36",
"_npmUser": {
"name": "timoxley",
"email": "secoif@gmail.com"
@@ -60,8 +60,8 @@
}
],
"dist": {
- "shasum": "30555796379865b016189c228cb0061764270ed0",
- "tarball": "http://registry.npmjs.org/columnify/-/columnify-1.4.1.tgz"
+ "shasum": "15fdda803a3875f87f9d302b3bc828932d664003",
+ "tarball": "http://registry.npmjs.org/columnify/-/columnify-1.5.1.tgz"
},
- "_resolved": "https://registry.npmjs.org/columnify/-/columnify-1.4.1.tgz"
+ "_resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.1.tgz"
}