summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/columnify/columnify.js
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2015-09-04 14:47:14 -0700
committerRod Vagg <rod@vagg.org>2015-09-06 21:38:09 +1000
commitd15ba80d6f7a473a70081768500260429ecb6218 (patch)
treed83559d4277c56eab5fffb986dd1e4ec8db94a4b /deps/npm/node_modules/columnify/columnify.js
parentb4f1711a629251f6aab7615907fe7358881e0648 (diff)
downloadnode-new-d15ba80d6f7a473a70081768500260429ecb6218.tar.gz
deps: upgrade to npm 2.14.2
PR-URL: https://github.com/nodejs/node/pull/2696 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rod Vagg <rod@vagg.org>
Diffstat (limited to 'deps/npm/node_modules/columnify/columnify.js')
-rw-r--r--deps/npm/node_modules/columnify/columnify.js26
1 files changed, 9 insertions, 17 deletions
diff --git a/deps/npm/node_modules/columnify/columnify.js b/deps/npm/node_modules/columnify/columnify.js
index db10a01181..42b2089a34 100644
--- a/deps/npm/node_modules/columnify/columnify.js
+++ b/deps/npm/node_modules/columnify/columnify.js
@@ -1,6 +1,4 @@
-'use strict';
-
-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); } };
+"use strict";
var wcwidth = require('./width');
@@ -35,7 +33,7 @@ var DEFAULTS = Object.freeze({
});
module.exports = function (items) {
- var options = arguments[1] === undefined ? {} : arguments[1];
+ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var columnConfigs = options.config || {};
delete options.config; // remove config so doesn't appear on every column.
@@ -217,6 +215,7 @@ function createRows(items, columns, columnNames, paddingChr) {
columnNames.forEach(function (columnName) {
numLines = Math.max(numLines, item[columnName].length);
});
+ // combine matching lines of each rows
var _loop = function (i) {
row[i] = row[i] || [];
@@ -227,7 +226,6 @@ function createRows(items, columns, columnNames, paddingChr) {
});
};
- // combine matching lines of each rows
for (var i = 0; i < numLines; i++) {
_loop(i);
}
@@ -242,18 +240,13 @@ function createRows(items, columns, columnNames, paddingChr) {
*/
function mixin() {
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- if (Object.assign) {
- return Object.assign.apply(Object, _toConsumableArray(args));
- }return ObjectAssign.apply(undefined, _toConsumableArray(args));
+ if (Object.assign) return Object.assign.apply(Object, arguments);
+ return ObjectAssign.apply(undefined, arguments);
}
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);
@@ -295,9 +288,8 @@ function endsWith(target, searchString, 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;