summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align')
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/.npmignore5
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/LICENSE14
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/README.md47
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/align.js65
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/package.json105
-rw-r--r--deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/test/align.js37
6 files changed, 273 insertions, 0 deletions
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/.npmignore b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/.npmignore
new file mode 100644
index 0000000000..d1a6b0054b
--- /dev/null
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/.npmignore
@@ -0,0 +1,5 @@
+*~
+/node_modules
+.#*
+/.nyc_output
+/coverage
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/LICENSE b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/LICENSE
new file mode 100644
index 0000000000..f4be44d881
--- /dev/null
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/LICENSE
@@ -0,0 +1,14 @@
+Copyright (c) 2015, Rebecca Turner <me@re-becca.org>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/README.md b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/README.md
new file mode 100644
index 0000000000..32f1be04f0
--- /dev/null
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/README.md
@@ -0,0 +1,47 @@
+wide-align
+----------
+
+A wide-character aware text alignment function for use in terminals / on the
+console.
+
+### Usage
+
+```
+var align = require('wide-align')
+
+// Note that if you view this on a unicode console, all of the slashes are
+// aligned. This is because on a console, all narrow characters are
+// an en wide and all wide characters are an em. In browsers, this isn't
+// held to and wide characters like "古" can be less than two narrow
+// characters even with a fixed width font.
+
+console.log(align.center('abc', 10)) // ' abc '
+console.log(align.center('古古古', 10)) // ' 古古古 '
+console.log(align.left('abc', 10)) // 'abc '
+console.log(align.left('古古古', 10)) // '古古古 '
+console.log(align.right('abc', 10)) // ' abc'
+console.log(align.right('古古古', 10)) // ' 古古古'
+```
+
+### Functions
+
+#### `align.center(str, length)` → `str`
+
+Returns *str* with spaces added to both sides such that that it is *length*
+chars long and centered in the spaces.
+
+#### `align.left(str, length)` → `str`
+
+Returns *str* with spaces to the right such that it is *length* chars long.
+
+### `align.right(str, length)` → `str`
+
+Returns *str* with spaces to the left such that it is *length* chars long.
+
+### Origins
+
+These functions were originally taken from
+[cliui](https://npmjs.com/package/cliui). Changes include switching to the
+MUCH faster pad generation function from
+[lodash](https://npmjs.com/package/lodash), making center alignment pad
+both sides and adding left alignment.
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/align.js b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/align.js
new file mode 100644
index 0000000000..4f94ca4cde
--- /dev/null
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/align.js
@@ -0,0 +1,65 @@
+'use strict'
+var stringWidth = require('string-width')
+
+exports.center = alignCenter
+exports.left = alignLeft
+exports.right = alignRight
+
+// lodash's way of generating pad characters.
+
+function createPadding (width) {
+ var result = ''
+ var string = ' '
+ var n = width
+ do {
+ if (n % 2) {
+ result += string;
+ }
+ n = Math.floor(n / 2);
+ string += string;
+ } while (n);
+
+ return result;
+}
+
+function alignLeft (str, width) {
+ var trimmed = str.trimRight()
+ if (trimmed.length === 0 && str.length >= width) return str
+ var padding = ''
+ var strWidth = stringWidth(trimmed)
+
+ if (strWidth < width) {
+ padding = createPadding(width - strWidth)
+ }
+
+ return trimmed + padding
+}
+
+function alignRight (str, width) {
+ var trimmed = str.trimLeft()
+ if (trimmed.length === 0 && str.length >= width) return str
+ var padding = ''
+ var strWidth = stringWidth(trimmed)
+
+ if (strWidth < width) {
+ padding = createPadding(width - strWidth)
+ }
+
+ return padding + trimmed
+}
+
+function alignCenter (str, width) {
+ var trimmed = str.trim()
+ if (trimmed.length === 0 && str.length >= width) return str
+ var padLeft = ''
+ var padRight = ''
+ var strWidth = stringWidth(trimmed)
+
+ if (strWidth < width) {
+ var padLeftBy = parseInt((width - strWidth) / 2, 10)
+ padLeft = createPadding(padLeftBy)
+ padRight = createPadding(width - (strWidth + padLeftBy))
+ }
+
+ return padLeft + trimmed + padRight
+}
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/package.json b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/package.json
new file mode 100644
index 0000000000..bdc7bfa6a4
--- /dev/null
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/package.json
@@ -0,0 +1,105 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "wide-align@^1.1.0",
+ "scope": null,
+ "escapedName": "wide-align",
+ "name": "wide-align",
+ "rawSpec": "^1.1.0",
+ "spec": ">=1.1.0 <2.0.0",
+ "type": "range"
+ },
+ "/Users/zkat/Documents/code/npm/node_modules/npmlog/node_modules/gauge"
+ ],
+ [
+ {
+ "raw": "wide-align@^1.1.0",
+ "scope": null,
+ "escapedName": "wide-align",
+ "name": "wide-align",
+ "rawSpec": "^1.1.0",
+ "spec": ">=1.1.0 <2.0.0",
+ "type": "range"
+ },
+ "/Users/zkat/Documents/code/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge"
+ ]
+ ],
+ "_from": "wide-align@^1.1.0",
+ "_id": "wide-align@1.1.0",
+ "_inCache": true,
+ "_location": "/npm-registry-client/npmlog/gauge/wide-align",
+ "_nodeVersion": "4.2.2",
+ "_npmUser": {
+ "name": "iarna",
+ "email": "me@re-becca.org"
+ },
+ "_npmVersion": "3.5.3",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "wide-align@^1.1.0",
+ "scope": null,
+ "escapedName": "wide-align",
+ "name": "wide-align",
+ "rawSpec": "^1.1.0",
+ "spec": ">=1.1.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/npm-registry-client/npmlog/gauge"
+ ],
+ "_resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.0.tgz",
+ "_shasum": "40edde802a71fea1f070da3e62dcda2e7add96ad",
+ "_shrinkwrap": null,
+ "_spec": "wide-align@^1.1.0",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge",
+ "author": {
+ "name": "Rebecca Turner",
+ "email": "me@re-becca.org",
+ "url": "http://re-becca.org/"
+ },
+ "bugs": {
+ "url": "https://github.com/iarna/wide-align/issues"
+ },
+ "dependencies": {
+ "string-width": "^1.0.1"
+ },
+ "description": "A wide-character aware text alignment function for use on the console or with fixed width fonts.",
+ "devDependencies": {
+ "tap": "^2.3.2"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "40edde802a71fea1f070da3e62dcda2e7add96ad",
+ "tarball": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.0.tgz"
+ },
+ "gitHead": "fe3f7f210650913d5bee702d7e19938f6977bc8a",
+ "homepage": "https://github.com/iarna/wide-align#readme",
+ "keywords": [
+ "wide",
+ "double",
+ "unicode",
+ "cjkv",
+ "pad",
+ "align"
+ ],
+ "license": "ISC",
+ "main": "align.js",
+ "maintainers": [
+ {
+ "name": "iarna",
+ "email": "me@re-becca.org"
+ }
+ ],
+ "name": "wide-align",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/iarna/wide-align.git"
+ },
+ "scripts": {
+ "test": "tap --coverage test/*.js"
+ },
+ "version": "1.1.0"
+}
diff --git a/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/test/align.js b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/test/align.js
new file mode 100644
index 0000000000..64e9f9dbda
--- /dev/null
+++ b/deps/npm/node_modules/npm-registry-client/node_modules/npmlog/node_modules/gauge/node_modules/wide-align/test/align.js
@@ -0,0 +1,37 @@
+'use strict'
+var test = require('tap').test
+var align = require('..')
+
+test('align', function (t) {
+ t.is(align.center('abc', 10), ' abc ', 'center narrow')
+ t.is(align.center('古古古', 10), ' 古古古 ', 'center wide')
+ t.is(align.left('abc', 10), 'abc ', 'left narrow')
+ t.is(align.left('古古古', 10), '古古古 ', 'left wide')
+ t.is(align.right('abc', 10), ' abc', 'right narrow')
+ t.is(align.right('古古古', 10), ' 古古古', 'right wide')
+
+ t.is(align.center('abc', 2), 'abc', 'center narrow overflow')
+ t.is(align.center('古古古', 4), '古古古', 'center wide overflow')
+ t.is(align.left('abc', 2), 'abc', 'left narrow overflow')
+ t.is(align.left('古古古', 4), '古古古', 'left wide overflow')
+ t.is(align.right('abc', 2), 'abc', 'right narrow overflow')
+ t.is(align.right('古古古', 4), '古古古', 'right wide overflow')
+
+ t.is(align.left('', 5), ' ', 'left align nothing')
+ t.is(align.center('', 5), ' ', 'center align nothing')
+ t.is(align.right('', 5), ' ', 'right align nothing')
+
+ t.is(align.left(' ', 5), ' ', 'left align whitespace')
+ t.is(align.center(' ', 5), ' ', 'center align whitespace')
+ t.is(align.right(' ', 5), ' ', 'right align whitespace')
+
+ t.is(align.left(' ', 2), ' ', 'left align whitespace overflow')
+ t.is(align.center(' ', 2), ' ', 'center align whitespace overflow')
+ t.is(align.right(' ', 2), ' ', 'right align whitespace overflow')
+
+ t.is(align.left('x ', 10), 'x ', 'left align whitespace mix')
+ t.is(align.center('x ', 10), ' x ', 'center align whitespace mix')
+ t.is(align.right('x ', 10), ' x', 'right align whitespace mix')
+
+ t.end()
+})