command-line-usage
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -20,3 +20,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Content).call(this)); | ||
var _this = _possibleConstructorReturn(this, (Content.__proto__ || Object.getPrototypeOf(Content)).call(this)); | ||
@@ -31,31 +31,31 @@ var defaultPadding = { left: ' ', right: ' ' }; | ||
} else if (t.isString(content)) { | ||
_this.add(tableLayout.lines({ column: ansi.format(content) }, { | ||
padding: defaultPadding, | ||
maxWidth: 80 | ||
})); | ||
} else if (Array.isArray(content) && content.every(t.isString)) { | ||
var rows = content.map(function (string) { | ||
return { column: ansi.format(string) }; | ||
}); | ||
_this.add(tableLayout.lines(rows, { | ||
padding: defaultPadding, | ||
maxWidth: 80 | ||
})); | ||
_this.add(); | ||
} else if (Array.isArray(content) && content.every(t.isPlainObject)) { | ||
_this.add(tableLayout.lines(content, { | ||
padding: defaultPadding | ||
})); | ||
} else if (t.isPlainObject(content)) { | ||
if (!content.options || !content.data) { | ||
throw new Error('must have an "options" or "data" property\n' + JSON.stringify(content)); | ||
} | ||
Object.assign({ padding: defaultPadding }, content.options); | ||
_this.add(tableLayout.lines(content.data.map(function (row) { | ||
return ansiFormatRow(row); | ||
}), content.options)); | ||
} else { | ||
var message = 'invalid input - \'content\' must be a string, array of strings, or array of plain objects:\n\n' + JSON.stringify(content); | ||
throw new Error(message); | ||
} | ||
_this.add(tableLayout.lines({ column: ansi.format(content) }, { | ||
padding: defaultPadding, | ||
maxWidth: 80 | ||
})); | ||
} else if (Array.isArray(content) && content.every(t.isString)) { | ||
var rows = content.map(function (string) { | ||
return { column: ansi.format(string) }; | ||
}); | ||
_this.add(tableLayout.lines(rows, { | ||
padding: defaultPadding, | ||
maxWidth: 80 | ||
})); | ||
_this.add(); | ||
} else if (Array.isArray(content) && content.every(t.isPlainObject)) { | ||
_this.add(tableLayout.lines(content, { | ||
padding: defaultPadding | ||
})); | ||
} else if (t.isPlainObject(content)) { | ||
if (!content.options || !content.data) { | ||
throw new Error('must have an "options" or "data" property\n' + JSON.stringify(content)); | ||
} | ||
Object.assign({ padding: defaultPadding }, content.options); | ||
_this.add(tableLayout.lines(content.data.map(function (row) { | ||
return ansiFormatRow(row); | ||
}), content.options)); | ||
} else { | ||
var message = 'invalid input - \'content\' must be a string, array of strings, or array of plain objects:\n\n' + JSON.stringify(content); | ||
throw new Error(message); | ||
} | ||
_this.emptyLine(); | ||
@@ -62,0 +62,0 @@ return _this; |
@@ -21,3 +21,3 @@ 'use strict'; | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(OptionList).call(this)); | ||
var _this = _possibleConstructorReturn(this, (OptionList.__proto__ || Object.getPrototypeOf(OptionList)).call(this)); | ||
@@ -24,0 +24,0 @@ var definitions = arrayify(data.optionList); |
{ | ||
"name": "command-line-usage", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "Generates command-line usage information", | ||
@@ -20,16 +20,17 @@ "repository": "https://github.com/75lb/command-line-usage.git", | ||
"docs": "jsdoc2md -t jsdoc2md/README.hbs --no-gfm lib/*.js > README.md; echo", | ||
"test": "tape test/*.js", | ||
"test": "test-runner test/*.js", | ||
"es5": "babel --presets babel-preset-es2015 --no-comments lib --out-dir es5" | ||
}, | ||
"dependencies": { | ||
"ansi-escape-sequences": "^2.2.2", | ||
"ansi-escape-sequences": "^3.0.0", | ||
"array-back": "^1.0.3", | ||
"table-layout": "~0.2.2", | ||
"feature-detect-es6": "^1.3.0", | ||
"typical": "^2.4.2" | ||
"feature-detect-es6": "^1.3.1", | ||
"typical": "^2.6.0" | ||
}, | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.9.0", | ||
"jsdoc-to-markdown": "^1.3.6", | ||
"tape": "^4.6.0" | ||
"babel-preset-es2015": "^6.16.0", | ||
"core-assert": "^0.2.1", | ||
"jsdoc-to-markdown": "^2.0.0", | ||
"test-runner": "^0.2.5" | ||
}, | ||
@@ -36,0 +37,0 @@ "standard": { |
@@ -1,5 +0,9 @@ | ||
var test = require('tape') | ||
'use strict' | ||
var TestRunner = require('test-runner') | ||
var getUsage = require('../') | ||
var a = require('core-assert') | ||
test('getUsage(sections)', function (t) { | ||
var runner = new TestRunner() | ||
runner.test('getUsage(sections)', function () { | ||
var definitions = [ | ||
@@ -32,6 +36,5 @@ { | ||
var result = getUsage(sections) | ||
t.ok(/a typical app/.test(result)) | ||
t.ok(/Generates something very important/.test(result)) | ||
t.ok(/Display this usage guide/.test(result)) | ||
t.end() | ||
a.ok(/a typical app/.test(result)) | ||
a.ok(/Generates something very important/.test(result)) | ||
a.ok(/Display this usage guide/.test(result)) | ||
}) |
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
816
854346
4
- Removedansi-escape-sequences@2.2.2(transitive)
- Removedcollect-all@0.2.1(transitive)
- Removedstream-via@0.1.1(transitive)
Updatedansi-escape-sequences@^3.0.0
Updatedfeature-detect-es6@^1.3.1
Updatedtypical@^2.6.0