optionator
Advanced tools
Comparing version 0.8.2 to 0.8.3
@@ -0,1 +1,5 @@ | ||
# 0.8.3 | ||
- changes dependency from `wordwrap` to `word-wrap` due to license issue | ||
- update dependencies | ||
# 0.8.2 | ||
@@ -2,0 +6,0 @@ - fix bug #18 - detect missing value when flag is last item |
@@ -1,7 +0,20 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
(function(){ | ||
var ref$, id, find, sort, min, max, map, unlines, nameToRaw, dasherize, naturalJoin, wordwrap, getPreText, setHelpStyleDefaults, generateHelpForOption, generateHelp; | ||
var ref$, id, find, sort, min, max, map, unlines, nameToRaw, dasherize, naturalJoin, wordWrap, wordwrap, getPreText, setHelpStyleDefaults, generateHelpForOption, generateHelp; | ||
ref$ = require('prelude-ls'), id = ref$.id, find = ref$.find, sort = ref$.sort, min = ref$.min, max = ref$.max, map = ref$.map, unlines = ref$.unlines; | ||
ref$ = require('./util'), nameToRaw = ref$.nameToRaw, dasherize = ref$.dasherize, naturalJoin = ref$.naturalJoin; | ||
wordwrap = require('wordwrap'); | ||
wordWrap = require('word-wrap'); | ||
wordwrap = function(a, b){ | ||
var ref$, indent, width; | ||
ref$ = b === undefined | ||
? ['', a - 1] | ||
: [repeatString$(' ', a), b - a - 1], indent = ref$[0], width = ref$[1]; | ||
return function(text){ | ||
return wordWrap(text, { | ||
indent: indent, | ||
width: width, | ||
trim: true | ||
}); | ||
}; | ||
}; | ||
getPreText = function(option, arg$, maxWidth){ | ||
@@ -8,0 +21,0 @@ var mainName, shortNames, ref$, longNames, type, description, aliasSeparator, typeSeparator, initialIndent, names, namesString, namesStringLen, typeSeparatorString, typeSeparatorStringLen, wrap; |
@@ -1,5 +0,5 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
(function(){ | ||
var VERSION, ref$, id, map, compact, any, groupBy, partition, chars, isItNaN, keys, Obj, camelize, deepIs, closestString, nameToRaw, dasherize, naturalJoin, generateHelp, generateHelpForOption, parsedTypeCheck, parseType, parseLevn, camelizeKeys, parseString, main, toString$ = {}.toString, slice$ = [].slice; | ||
VERSION = '0.8.2'; | ||
var VERSION, ref$, id, map, compact, any, groupBy, partition, chars, isItNaN, keys, Obj, camelize, deepIs, closestString, nameToRaw, dasherize, naturalJoin, generateHelp, generateHelpForOption, parsedTypeCheck, parseType, parseLevn, camelizeKeys, parseString, main, toString$ = {}.toString, slice$ = [].slice, arrayFrom$ = Array.from || function(x){return slice$.call(x);}; | ||
VERSION = '0.8.3'; | ||
ref$ = require('prelude-ls'), id = ref$.id, map = ref$.map, compact = ref$.compact, any = ref$.any, groupBy = ref$.groupBy, partition = ref$.partition, chars = ref$.chars, isItNaN = ref$.isItNaN, keys = ref$.keys, Obj = ref$.Obj, camelize = ref$.camelize; | ||
@@ -20,3 +20,3 @@ deepIs = require('deep-is'); | ||
parseString = function(string){ | ||
var assignOpt, regex, replaceRegex, result, this$ = this; | ||
var assignOpt, regex, replaceRegex, result; | ||
assignOpt = '--?[a-zA-Z][-a-z-A-Z0-9]*='; | ||
@@ -48,3 +48,3 @@ regex = RegExp('(?:' + assignOpt + ')?(?:\'(?:\\\\\'|[^\'])+\'|"(?:\\\\"|[^"])+")|[^\'"\\s]+', 'g'); | ||
traverse = function(options){ | ||
var i$, len$, option, name, k, ref$, v, type, that, e, parsedPossibilities, parsedType, j$, len1$, possibility, rawDependsType, dependsOpts, dependsType, cra, alias, shortNames, longNames, this$ = this; | ||
var i$, len$, option, name, k, ref$, v, type, that, e, parsedPossibilities, parsedType, j$, len1$, possibility, rawDependsType, dependsOpts, dependsType, cra, alias, shortNames, longNames; | ||
if (toString$.call(options).slice(8, -1) !== 'Array') { | ||
@@ -109,3 +109,3 @@ throw new Error('No options defined.'); | ||
if (dependsType === 'and' || dependsType === 'or') { | ||
option.dependsOn = [dependsType].concat(slice$.call(dependsOpts)); | ||
option.dependsOn = [dependsType].concat(arrayFrom$(dependsOpts)); | ||
} else { | ||
@@ -112,0 +112,0 @@ throw new Error("Option '" + name + "': If you have more than one dependency, you must specify either 'and' or 'or'"); |
@@ -1,2 +0,2 @@ | ||
// Generated by LiveScript 1.5.0 | ||
// Generated by LiveScript 1.6.0 | ||
(function(){ | ||
@@ -7,3 +7,3 @@ var prelude, map, sortBy, fl, closestString, nameToRaw, dasherize, naturalJoin; | ||
closestString = function(possibilities, input){ | ||
var distances, ref$, string, distance, this$ = this; | ||
var distances, ref$, string, distance; | ||
if (!possibilities.length) { | ||
@@ -10,0 +10,0 @@ return; |
{ | ||
"name": "optionator", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"author": "George Zahariev <z@georgezahariev.com>", | ||
@@ -34,12 +34,12 @@ "description": "option parsing and help generation", | ||
"deep-is": "~0.1.3", | ||
"wordwrap": "~1.0.0", | ||
"word-wrap": "~1.2.3", | ||
"type-check": "~0.3.2", | ||
"levn": "~0.3.0", | ||
"fast-levenshtein": "~2.0.4" | ||
"fast-levenshtein": "~2.0.6" | ||
}, | ||
"devDependencies": { | ||
"livescript": "~1.5.0", | ||
"mocha": "~3.0.2", | ||
"istanbul": "~0.4.1" | ||
"livescript": "~1.6.0", | ||
"mocha": "~6.2.2", | ||
"istanbul": "~0.4.5" | ||
} | ||
} |
# Optionator | ||
<a name="optionator" /> | ||
Optionator is a JavaScript option parsing and help generation library used by [eslint](http://eslint.org), [Grasp](http://graspjs.com), [LiveScript](http://livescript.net), [esmangle](https://github.com/estools/esmangle), [escodegen](https://github.com/estools/escodegen), and [many more](https://www.npmjs.com/browse/depended/optionator). | ||
Optionator is a JavaScript/Node.js option parsing and help generation library used by [eslint](http://eslint.org), [Grasp](http://graspjs.com), [LiveScript](http://livescript.net), [esmangle](https://github.com/estools/esmangle), [escodegen](https://github.com/estools/escodegen), and [many more](https://www.npmjs.com/browse/depended/optionator). | ||
@@ -26,3 +26,3 @@ For an online demo, check out the [Grasp online demo](http://www.graspjs.com/#demo). | ||
MIT license. Version 0.8.2 | ||
MIT license. Version 0.8.3 | ||
@@ -33,2 +33,4 @@ npm install optionator | ||
Optionator is a Node.js module, but can be used in the browser as well if packed with webpack/browserify. | ||
## Usage | ||
@@ -35,0 +37,0 @@ `require('optionator');` returns a function. It has one property, `VERSION`, the current version of the library as a string. This function is called with an object specifying your options and other information, see the [settings format section](#settings-format). This in turn returns an object with three properties, `parse`, `parseArgv`, `generateHelp`, and `generateHelpForOption`, which are all functions. |
50062
782
239
+ Addedword-wrap@~1.2.3
+ Addedword-wrap@1.2.5(transitive)
- Removedwordwrap@~1.0.0
- Removedwordwrap@1.0.0(transitive)
Updatedfast-levenshtein@~2.0.6