summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/columnify
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2016-01-28 18:11:35 -0800
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2016-02-01 10:43:34 -0500
commit76cb81b354de8447898427619c66c86c59b22b3d (patch)
tree0c0826bed77086fb38cda8dc680d4fb10d2cff25 /deps/npm/node_modules/columnify
parentd5d301f3032a0723f5a29cfbe0d95ac4ad205d42 (diff)
downloadandroid-node-v8-76cb81b354de8447898427619c66c86c59b22b3d.tar.gz
android-node-v8-76cb81b354de8447898427619c66c86c59b22b3d.tar.bz2
android-node-v8-76cb81b354de8447898427619c66c86c59b22b3d.zip
deps: upgrade npm to 3.6.0
PR-URL: https://github.com/nodejs/node/pull/4958 Reviewed-By: Myles Borins <mborins@us.ibm.com> Reviewed-By: Kat Marchán <kzm@sykosomatic.org> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/node_modules/columnify')
-rw-r--r--deps/npm/node_modules/columnify/columnify.js11
-rw-r--r--deps/npm/node_modules/columnify/index.js4
-rw-r--r--deps/npm/node_modules/columnify/package.json118
-rw-r--r--deps/npm/node_modules/columnify/utils.js55
4 files changed, 122 insertions, 66 deletions
diff --git a/deps/npm/node_modules/columnify/columnify.js b/deps/npm/node_modules/columnify/columnify.js
index 42b2089a34..334d5509ae 100644
--- a/deps/npm/node_modules/columnify/columnify.js
+++ b/deps/npm/node_modules/columnify/columnify.js
@@ -145,6 +145,8 @@ module.exports = function (items) {
column.width = items.map(function (item) {
return item[columnName];
}).reduce(function (min, cur) {
+ // if already at maxWidth don't bother testing
+ if (min >= column.maxWidth) return min;
return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, wcwidth(cur))));
}, 0);
});
@@ -181,9 +183,11 @@ module.exports = function (items) {
var column = columns[columnName];
column.width = items.map(function (item) {
return item[columnName].reduce(function (min, cur) {
+ if (min >= column.maxWidth) return min;
return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, wcwidth(cur))));
}, 0);
}).reduce(function (min, cur) {
+ if (min >= column.maxWidth) return min;
return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, cur)));
}, 0);
});
@@ -217,7 +221,7 @@ function createRows(items, columns, columnNames, paddingChr) {
});
// combine matching lines of each rows
- var _loop = function (i) {
+ var _loop = function _loop(i) {
row[i] = row[i] || [];
columnNames.forEach(function (columnName) {
var column = columns[columnName];
@@ -240,12 +244,15 @@ function createRows(items, columns, columnNames, paddingChr) {
*/
function mixin() {
- if (Object.assign) return Object.assign.apply(Object, arguments);
+ var _Object;
+
+ if (Object.assign) return (_Object = 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");
var to = Object(target);
diff --git a/deps/npm/node_modules/columnify/index.js b/deps/npm/node_modules/columnify/index.js
index 227b41efc6..221269b3e7 100644
--- a/deps/npm/node_modules/columnify/index.js
+++ b/deps/npm/node_modules/columnify/index.js
@@ -135,6 +135,8 @@ module.exports = function(items, options = {}) {
column.width = items
.map(item => item[columnName])
.reduce((min, cur) => {
+ // if already at maxWidth don't bother testing
+ if (min >= column.maxWidth) return min
return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, wcwidth(cur))))
}, 0)
})
@@ -171,9 +173,11 @@ module.exports = function(items, options = {}) {
let column = columns[columnName]
column.width = items.map(item => {
return item[columnName].reduce((min, cur) => {
+ if (min >= column.maxWidth) return min
return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, wcwidth(cur))))
}, 0)
}).reduce((min, cur) => {
+ if (min >= column.maxWidth) return min
return Math.max(min, Math.min(column.maxWidth, Math.max(column.minWidth, cur)))
}, 0)
})
diff --git a/deps/npm/node_modules/columnify/package.json b/deps/npm/node_modules/columnify/package.json
index c4345001f3..a661b6e356 100644
--- a/deps/npm/node_modules/columnify/package.json
+++ b/deps/npm/node_modules/columnify/package.json
@@ -1,68 +1,100 @@
{
- "name": "columnify",
- "version": "1.5.2",
- "description": "Render data in text columns. Supports in-column text-wrap.",
- "main": "columnify.js",
- "scripts": {
- "pretest": "npm prune",
- "test": "make prepublish && tape test/*.js | tap-spec",
- "bench": "npm test && node bench",
- "prepublish": "make prepublish"
+ "_args": [
+ [
+ "columnify@1.5.4",
+ "/Users/rebecca/code/npm"
+ ]
+ ],
+ "_from": "columnify@1.5.4",
+ "_id": "columnify@1.5.4",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/columnify",
+ "_nodeVersion": "4.2.3",
+ "_npmUser": {
+ "email": "secoif@gmail.com",
+ "name": "timoxley"
+ },
+ "_npmVersion": "2.14.7",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "columnify",
+ "raw": "columnify@1.5.4",
+ "rawSpec": "1.5.4",
+ "scope": null,
+ "spec": "1.5.4",
+ "type": "version"
},
+ "_requiredBy": [
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.4.tgz",
+ "_shasum": "4737ddf1c7b69a8a7c340570782e947eec8e78bb",
+ "_shrinkwrap": null,
+ "_spec": "columnify@1.5.4",
+ "_where": "/Users/rebecca/code/npm",
"author": {
"name": "Tim Oxley"
},
- "license": "MIT",
- "devDependencies": {
- "babel": "^5.8.21",
- "chalk": "^1.1.0",
- "tap-spec": "^4.0.2",
- "tape": "^4.0.3"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/timoxley/columnify.git"
+ "babel": {
+ "presets": [
+ "es2015"
+ ]
},
- "keywords": [
- "column",
- "text",
- "ansi",
- "console",
- "terminal",
- "wrap",
- "table"
- ],
"bugs": {
"url": "https://github.com/timoxley/columnify/issues"
},
- "homepage": "https://github.com/timoxley/columnify",
"dependencies": {
"strip-ansi": "^3.0.0",
"wcwidth": "^1.0.0"
},
+ "description": "Render data in text columns. Supports in-column text-wrap.",
+ "devDependencies": {
+ "babel": "^6.3.26",
+ "babel-cli": "^6.3.17",
+ "babel-preset-es2015": "^6.3.13",
+ "chalk": "^1.1.1",
+ "tap-spec": "^4.1.1",
+ "tape": "^4.4.0"
+ },
"directories": {
"test": "test"
},
- "gitHead": "e7417b78091844ff2f3ba62551a4817c7ae217bd",
- "_id": "columnify@1.5.2",
- "_shasum": "6937930d47c22a9bfa20732a7fd619d47eaba65a",
- "_from": "columnify@>=1.5.2 <1.6.0",
- "_npmVersion": "2.9.0",
- "_nodeVersion": "2.0.1",
- "_npmUser": {
- "name": "timoxley",
- "email": "secoif@gmail.com"
+ "dist": {
+ "shasum": "4737ddf1c7b69a8a7c340570782e947eec8e78bb",
+ "tarball": "http://registry.npmjs.org/columnify/-/columnify-1.5.4.tgz"
},
+ "gitHead": "b5373b3d6344bf59e1ab63c912c188c34bce5889",
+ "homepage": "https://github.com/timoxley/columnify",
+ "keywords": [
+ "ansi",
+ "column",
+ "console",
+ "table",
+ "terminal",
+ "text",
+ "wrap"
+ ],
+ "license": "MIT",
+ "main": "columnify.js",
"maintainers": [
{
"name": "timoxley",
"email": "secoif@gmail.com"
}
],
- "dist": {
- "shasum": "6937930d47c22a9bfa20732a7fd619d47eaba65a",
- "tarball": "http://registry.npmjs.org/columnify/-/columnify-1.5.2.tgz"
+ "name": "columnify",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/timoxley/columnify.git"
+ },
+ "scripts": {
+ "bench": "npm test && node bench",
+ "prepublish": "make prepublish",
+ "pretest": "npm prune",
+ "test": "make prepublish && tape test/*.js | tap-spec"
},
- "_resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.2.tgz",
- "readme": "ERROR: No README data found!"
+ "version": "1.5.4"
}
diff --git a/deps/npm/node_modules/columnify/utils.js b/deps/npm/node_modules/columnify/utils.js
index 30682af3b1..df3e6cc44e 100644
--- a/deps/npm/node_modules/columnify/utils.js
+++ b/deps/npm/node_modules/columnify/utils.js
@@ -108,33 +108,46 @@ function splitIntoLines(str, max) {
* @return String
*/
-function splitLongWords(str, max, truncationChar, result) {
+function splitLongWords(str, max, truncationChar) {
str = str.trim()
- result = result || []
- if (!str) return result.join(' ') || ''
+ var result = []
var words = str.split(' ')
- var word = words.shift() || str
- if (wcwidth(word) > max) {
- // slice is based on length no wcwidth
- var i = 0
- var wwidth = 0
- var limit = max - wcwidth(truncationChar)
- while (i < word.length) {
- var w = wcwidth(word.charAt(i))
- if(w + wwidth > limit)
- break
- wwidth += w
- ++i
+ var remainder = ''
+
+ var truncationWidth = wcwidth(truncationChar)
+
+ while (remainder || words.length) {
+ if (remainder) {
+ var word = remainder
+ remainder = ''
+ } else {
+ var word = words.shift()
}
- var remainder = word.slice(i) // get remainder
- words.unshift(remainder) // save remainder for next loop
+ if (wcwidth(word) > max) {
+ // slice is based on length no wcwidth
+ var i = 0
+ var wwidth = 0
+ var limit = max - truncationWidth
+ while (i < word.length) {
+ var w = wcwidth(word.charAt(i))
+ if (w + wwidth > limit) {
+ break
+ }
+ wwidth += w
+ ++i
+ }
+
+ remainder = word.slice(i) // get remainder
+ // save remainder for next loop
- word = word.slice(0, i) // grab truncated word
- word += truncationChar // add trailing … or whatever
+ word = word.slice(0, i) // grab truncated word
+ word += truncationChar // add trailing … or whatever
+ }
+ result.push(word)
}
- result.push(word)
- return splitLongWords(words.join(' '), max, truncationChar, result)
+
+ return result.join(' ')
}