summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/argparse
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-02-15 14:45:53 -0800
committerRich Trott <rtrott@gmail.com>2016-02-18 10:13:13 -0800
commitd7aa8fa088f3b8a31c7d85c6d71824c8c60e7c17 (patch)
tree739f4a86de562584f10eba7f1a06a406d8d66366 /tools/eslint/node_modules/argparse
parentd3c3a928c3a2f9e961881b47ef0796e57ae8d429 (diff)
downloadnode-new-d7aa8fa088f3b8a31c7d85c6d71824c8c60e7c17.tar.gz
tools: update ESLint to version 2.1.0
Update ESLint to 2.1.0. ESLint has a number of potentially-useful new features but this change attempts to be minimal in its changes. However, some things could not be avoided reasonably. ESLint 2.1.0 found a few lint issues that ESLing 1.x missed with template strings that did not take advantage of any features of template strings, and `let` declarations where `const` sufficed. Additionally, ESLint 2.1.0 removes some granularity around enabling ES6 features. Some features (e.g., spread operator) that had been turned off in our configuration for ESLint 1.x are now permitted. PR-URL: https://github.com/nodejs/node/pull/5214 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'tools/eslint/node_modules/argparse')
-rw-r--r--tools/eslint/node_modules/argparse/CHANGELOG.md161
-rw-r--r--tools/eslint/node_modules/argparse/index.js2
-rw-r--r--tools/eslint/node_modules/argparse/lib/action.js22
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/append.js6
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/append/constant.js2
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/help.js9
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/store.js4
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/store/constant.js2
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/store/false.js2
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/store/true.js2
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/subparsers.js27
-rw-r--r--tools/eslint/node_modules/argparse/lib/action/version.js6
-rw-r--r--tools/eslint/node_modules/argparse/lib/action_container.js61
-rw-r--r--tools/eslint/node_modules/argparse/lib/argument_parser.js259
-rw-r--r--tools/eslint/node_modules/argparse/lib/const.js3
-rw-r--r--tools/eslint/node_modules/argparse/lib/help/added_formatters.js23
-rw-r--r--tools/eslint/node_modules/argparse/lib/help/formatter.js203
-rw-r--r--tools/eslint/node_modules/argparse/lib/namespace.js13
-rw-r--r--tools/eslint/node_modules/argparse/lib/utils.js57
-rw-r--r--tools/eslint/node_modules/argparse/package.json46
20 files changed, 565 insertions, 345 deletions
diff --git a/tools/eslint/node_modules/argparse/CHANGELOG.md b/tools/eslint/node_modules/argparse/CHANGELOG.md
new file mode 100644
index 0000000000..1ab14f08ef
--- /dev/null
+++ b/tools/eslint/node_modules/argparse/CHANGELOG.md
@@ -0,0 +1,161 @@
+1.0.6 / 2016-02-06
+------------------
+
+- Maintenance: moved to eslint & updated CS.
+
+
+1.0.5 / 2016-02-05
+------------------
+
+- Removed lodash dependency to significantly reduce install size.
+ Thanks to @mourner.
+
+
+1.0.4 / 2016-01-17
+------------------
+
+- Maintenance: lodash update to 4.0.0.
+
+
+1.0.3 / 2015-10-27
+------------------
+
+- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple.
+
+
+1.0.2 / 2015-03-22
+------------------
+
+- Relaxed lodash version dependency.
+
+
+1.0.1 / 2015-02-20
+------------------
+
+- Changed dependencies to be compatible with ancient nodejs.
+
+
+1.0.0 / 2015-02-19
+------------------
+
+- Maintenance release.
+- Replaced `underscore` with `lodash`.
+- Bumped version to 1.0.0 to better reflect semver meaning.
+- HISTORY.md -> CHANGELOG.md
+
+
+0.1.16 / 2013-12-01
+-------------------
+
+- Maintenance release. Updated dependencies and docs.
+
+
+0.1.15 / 2013-05-13
+-------------------
+
+- Fixed #55, @trebor89
+
+
+0.1.14 / 2013-05-12
+-------------------
+
+- Fixed #62, @maxtaco
+
+
+0.1.13 / 2013-04-08
+-------------------
+
+- Added `.npmignore` to reduce package size
+
+
+0.1.12 / 2013-02-10
+-------------------
+
+- Fixed conflictHandler (#46), @hpaulj
+
+
+0.1.11 / 2013-02-07
+-------------------
+
+- Multiple bugfixes, @hpaulj
+- Added 70+ tests (ported from python), @hpaulj
+- Added conflictHandler, @applepicke
+- Added fromfilePrefixChar, @hpaulj
+
+
+0.1.10 / 2012-12-30
+-------------------
+
+- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
+ support, thanks to @hpaulj
+- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
+
+
+0.1.9 / 2012-12-27
+------------------
+
+- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
+- Fixed default value behavior with `*` positionals, thanks to @hpaulj
+- Improve `getDefault()` behavior, thanks to @hpaulj
+- Imrove negative argument parsing, thanks to @hpaulj
+
+
+0.1.8 / 2012-12-01
+------------------
+
+- Fixed parser parents (issue #19), thanks to @hpaulj
+- Fixed negative argument parse (issue #20), thanks to @hpaulj
+
+
+0.1.7 / 2012-10-14
+------------------
+
+- Fixed 'choices' argument parse (issue #16)
+- Fixed stderr output (issue #15)
+
+
+0.1.6 / 2012-09-09
+------------------
+
+- Fixed check for conflict of options (thanks to @tomxtobin)
+
+
+0.1.5 / 2012-09-03
+------------------
+
+- Fix parser #setDefaults method (thanks to @tomxtobin)
+
+
+0.1.4 / 2012-07-30
+------------------
+
+- Fixed pseudo-argument support (thanks to @CGamesPlay)
+- Fixed addHelp default (should be true), if not set (thanks to @benblank)
+
+
+0.1.3 / 2012-06-27
+------------------
+
+- Fixed formatter api name: Formatter -> HelpFormatter
+
+
+0.1.2 / 2012-05-29
+------------------
+
+- Added basic tests
+- Removed excess whitespace in help
+- Fixed error reporting, when parcer with subcommands
+ called with empty arguments
+
+
+0.1.1 / 2012-05-23
+------------------
+
+- Fixed line wrapping in help formatter
+- Added better error reporting on invalid arguments
+
+
+0.1.0 / 2012-05-16
+------------------
+
+- First release.
diff --git a/tools/eslint/node_modules/argparse/index.js b/tools/eslint/node_modules/argparse/index.js
index 3b6eea0138..3bbc143200 100644
--- a/tools/eslint/node_modules/argparse/index.js
+++ b/tools/eslint/node_modules/argparse/index.js
@@ -1 +1,3 @@
+'use strict';
+
module.exports = require('./lib/argparse');
diff --git a/tools/eslint/node_modules/argparse/lib/action.js b/tools/eslint/node_modules/argparse/lib/action.js
index 6f7e9a56cc..ef35989932 100644
--- a/tools/eslint/node_modules/argparse/lib/action.js
+++ b/tools/eslint/node_modules/argparse/lib/action.js
@@ -32,7 +32,7 @@
// Constants
-var $$ = require('./const');
+var c = require('./const');
/**
@@ -74,19 +74,19 @@ var Action = module.exports = function Action(options) {
options = options || {};
this.optionStrings = options.optionStrings || [];
this.dest = options.dest;
- this.nargs = options.nargs !== undefined ? options.nargs : null;
- this.constant = options.constant !== undefined ? options.constant : null;
+ this.nargs = typeof options.nargs !== 'undefined' ? options.nargs : null;
+ this.constant = typeof options.constant !== 'undefined' ? options.constant : null;
this.defaultValue = options.defaultValue;
- this.type = options.type !== undefined ? options.type : null;
- this.choices = options.choices !== undefined ? options.choices : null;
- this.required = options.required !== undefined ? options.required: false;
- this.help = options.help !== undefined ? options.help : null;
- this.metavar = options.metavar !== undefined ? options.metavar : null;
+ this.type = typeof options.type !== 'undefined' ? options.type : null;
+ this.choices = typeof options.choices !== 'undefined' ? options.choices : null;
+ this.required = typeof options.required !== 'undefined' ? options.required : false;
+ this.help = typeof options.help !== 'undefined' ? options.help : null;
+ this.metavar = typeof options.metavar !== 'undefined' ? options.metavar : null;
if (!(this.optionStrings instanceof Array)) {
throw new Error('optionStrings should be an array');
}
- if (this.required !== undefined && typeof(this.required) !== 'boolean') {
+ if (typeof this.required !== 'undefined' && typeof this.required !== 'boolean') {
throw new Error('required should be a boolean');
}
};
@@ -99,9 +99,9 @@ var Action = module.exports = function Action(options) {
Action.prototype.getName = function () {
if (this.optionStrings.length > 0) {
return this.optionStrings.join('/');
- } else if (this.metavar !== null && this.metavar !== $$.SUPPRESS) {
+ } else if (this.metavar !== null && this.metavar !== c.SUPPRESS) {
return this.metavar;
- } else if (this.dest !== undefined && this.dest !== $$.SUPPRESS) {
+ } else if (typeof this.dest !== 'undefined' && this.dest !== c.SUPPRESS) {
return this.dest;
}
return null;
diff --git a/tools/eslint/node_modules/argparse/lib/action/append.js b/tools/eslint/node_modules/argparse/lib/action/append.js
index 79df02e579..b5da0de232 100644
--- a/tools/eslint/node_modules/argparse/lib/action/append.js
+++ b/tools/eslint/node_modules/argparse/lib/action/append.js
@@ -14,7 +14,7 @@ var util = require('util');
var Action = require('../action');
// Constants
-var $$ = require('../const');
+var c = require('../const');
/*:nodoc:*
* new ActionAppend(options)
@@ -30,7 +30,7 @@ var ActionAppend = module.exports = function ActionAppend(options) {
'strings are not supplying the value to append, ' +
'the append const action may be more appropriate');
}
- if (!!this.constant && this.nargs !== $$.OPTIONAL) {
+ if (!!this.constant && this.nargs !== c.OPTIONAL) {
throw new Error('nargs must be OPTIONAL to supply const');
}
Action.call(this, options);
@@ -47,7 +47,7 @@ util.inherits(ActionAppend, Action);
* Call the action. Save result in namespace object
**/
ActionAppend.prototype.call = function (parser, namespace, values) {
- var items = [].concat(namespace[this.dest] || []); // or _.clone
+ var items = (namespace[this.dest] || []).slice();
items.push(values);
namespace.set(this.dest, items);
};
diff --git a/tools/eslint/node_modules/argparse/lib/action/append/constant.js b/tools/eslint/node_modules/argparse/lib/action/append/constant.js
index 90747abbf6..313f5d2efc 100644
--- a/tools/eslint/node_modules/argparse/lib/action/append/constant.js
+++ b/tools/eslint/node_modules/argparse/lib/action/append/constant.js
@@ -24,7 +24,7 @@ var Action = require('../../action');
var ActionAppendConstant = module.exports = function ActionAppendConstant(options) {
options = options || {};
options.nargs = 0;
- if (options.constant === undefined) {
+ if (typeof options.constant === 'undefined') {
throw new Error('constant option is required for appendAction');
}
Action.call(this, options);
diff --git a/tools/eslint/node_modules/argparse/lib/action/help.js b/tools/eslint/node_modules/argparse/lib/action/help.js
index 7f7b4e2d21..b40e05a6f0 100644
--- a/tools/eslint/node_modules/argparse/lib/action/help.js
+++ b/tools/eslint/node_modules/argparse/lib/action/help.js
@@ -11,7 +11,7 @@ var util = require('util');
var Action = require('../action');
// Constants
-var $$ = require('../const');
+var c = require('../const');
/*:nodoc:*
* new ActionHelp(options)
@@ -22,11 +22,10 @@ var ActionHelp = module.exports = function ActionHelp(options) {
options = options || {};
if (options.defaultValue !== null) {
options.defaultValue = options.defaultValue;
+ } else {
+ options.defaultValue = c.SUPPRESS;
}
- else {
- options.defaultValue = $$.SUPPRESS;
- }
- options.dest = (options.dest !== null ? options.dest: $$.SUPPRESS);
+ options.dest = (options.dest !== null ? options.dest : c.SUPPRESS);
options.nargs = 0;
Action.call(this, options);
diff --git a/tools/eslint/node_modules/argparse/lib/action/store.js b/tools/eslint/node_modules/argparse/lib/action/store.js
index 8ebc9748b6..283b860921 100644
--- a/tools/eslint/node_modules/argparse/lib/action/store.js
+++ b/tools/eslint/node_modules/argparse/lib/action/store.js
@@ -13,7 +13,7 @@ var util = require('util');
var Action = require('../action');
// Constants
-var $$ = require('../const');
+var c = require('../const');
/*:nodoc:*
@@ -29,7 +29,7 @@ var ActionStore = module.exports = function ActionStore(options) {
'true or store const may be more appropriate');
}
- if (this.constant !== undefined && this.nargs !== $$.OPTIONAL) {
+ if (typeof this.constant !== 'undefined' && this.nargs !== c.OPTIONAL) {
throw new Error('nargs must be OPTIONAL to supply const');
}
Action.call(this, options);
diff --git a/tools/eslint/node_modules/argparse/lib/action/store/constant.js b/tools/eslint/node_modules/argparse/lib/action/store/constant.js
index 8410fcf784..23caa897b3 100644
--- a/tools/eslint/node_modules/argparse/lib/action/store/constant.js
+++ b/tools/eslint/node_modules/argparse/lib/action/store/constant.js
@@ -22,7 +22,7 @@ var Action = require('../../action');
var ActionStoreConstant = module.exports = function ActionStoreConstant(options) {
options = options || {};
options.nargs = 0;
- if (options.constant === undefined) {
+ if (typeof options.constant === 'undefined') {
throw new Error('constant option is required for storeAction');
}
Action.call(this, options);
diff --git a/tools/eslint/node_modules/argparse/lib/action/store/false.js b/tools/eslint/node_modules/argparse/lib/action/store/false.js
index 66417bf6d8..9924f461da 100644
--- a/tools/eslint/node_modules/argparse/lib/action/store/false.js
+++ b/tools/eslint/node_modules/argparse/lib/action/store/false.js
@@ -21,7 +21,7 @@ var ActionStoreConstant = require('./constant');
var ActionStoreFalse = module.exports = function ActionStoreFalse(options) {
options = options || {};
options.constant = false;
- options.defaultValue = options.defaultValue !== null ? options.defaultValue: true;
+ options.defaultValue = options.defaultValue !== null ? options.defaultValue : true;
ActionStoreConstant.call(this, options);
};
util.inherits(ActionStoreFalse, ActionStoreConstant);
diff --git a/tools/eslint/node_modules/argparse/lib/action/store/true.js b/tools/eslint/node_modules/argparse/lib/action/store/true.js
index 43ec7086f6..9e22f7d441 100644
--- a/tools/eslint/node_modules/argparse/lib/action/store/true.js
+++ b/tools/eslint/node_modules/argparse/lib/action/store/true.js
@@ -20,7 +20,7 @@ var ActionStoreConstant = require('./constant');
var ActionStoreTrue = module.exports = function ActionStoreTrue(options) {
options = options || {};
options.constant = true;
- options.defaultValue = options.defaultValue !== null ? options.defaultValue: false;
+ options.defaultValue = options.defaultValue !== null ? options.defaultValue : false;
ActionStoreConstant.call(this, options);
};
util.inherits(ActionStoreTrue, ActionStoreConstant);
diff --git a/tools/eslint/node_modules/argparse/lib/action/subparsers.js b/tools/eslint/node_modules/argparse/lib/action/subparsers.js
index 45f034564c..99dfedd0f1 100644
--- a/tools/eslint/node_modules/argparse/lib/action/subparsers.js
+++ b/tools/eslint/node_modules/argparse/lib/action/subparsers.js
@@ -9,13 +9,12 @@
var util = require('util');
var format = require('util').format;
-var _ = require('lodash');
var Action = require('../action');
// Constants
-var $$ = require('../const');
+var c = require('../const');
// Errors
var argumentErrorHelper = require('../argument/error');
@@ -27,7 +26,7 @@ var argumentErrorHelper = require('../argument/error');
* Create pseudo action for correct help text
*
**/
-var ChoicesPseudoAction = function (name, help) {
+function ChoicesPseudoAction(name, help) {
var options = {
optionStrings: [],
dest: name,
@@ -35,7 +34,8 @@ var ChoicesPseudoAction = function (name, help) {
};
Action.call(this, options);
-};
+}
+
util.inherits(ChoicesPseudoAction, Action);
/**
@@ -43,10 +43,10 @@ util.inherits(ChoicesPseudoAction, Action);
* - options (object): options hash see [[Action.new]]
*
**/
-var ActionSubparsers = module.exports = function ActionSubparsers(options) {
+function ActionSubparsers(options) {
options = options || {};
- options.dest = options.dest || $$.SUPPRESS;
- options.nargs = $$.PARSER;
+ options.dest = options.dest || c.SUPPRESS;
+ options.nargs = c.PARSER;
this.debug = (options.debug === true);
@@ -57,7 +57,8 @@ var ActionSubparsers = module.exports = function ActionSubparsers(options) {
options.choices = this._nameParserMap;
Action.call(this, options);
-};
+}
+
util.inherits(ActionSubparsers, Action);
/*:nodoc:*
@@ -88,7 +89,7 @@ ActionSubparsers.prototype.addParser = function (name, options) {
var aliases = options.aliases || [];
// create a pseudo-action to hold the choice help
- if (!!options.help || _.isString(options.help)) {
+ if (!!options.help || typeof options.help === 'string') {
var help = options.help;
delete options.help;
@@ -126,21 +127,23 @@ ActionSubparsers.prototype.call = function (parser, namespace, values) {
var argStrings = values.slice(1);
// set the parser name if requested
- if (this.dest !== $$.SUPPRESS) {
+ if (this.dest !== c.SUPPRESS) {
namespace[this.dest] = parserName;
}
// select the parser
- if (!!this._nameParserMap[parserName]) {
+ if (this._nameParserMap[parserName]) {
parser = this._nameParserMap[parserName];
} else {
throw argumentErrorHelper(format(
'Unknown parser "%s" (choices: [%s]).',
parserName,
- _.keys(this._nameParserMap).join(', ')
+ Object.keys(this._nameParserMap).join(', ')
));
}
// parse all the remaining options into the namespace
parser.parseArgs(argStrings, namespace);
};
+
+module.exports = ActionSubparsers;
diff --git a/tools/eslint/node_modules/argparse/lib/action/version.js b/tools/eslint/node_modules/argparse/lib/action/version.js
index cf262408f1..8053328cde 100644
--- a/tools/eslint/node_modules/argparse/lib/action/version.js
+++ b/tools/eslint/node_modules/argparse/lib/action/version.js
@@ -13,7 +13,7 @@ var Action = require('../action');
//
// Constants
//
-var $$ = require('../const');
+var c = require('../const');
/*:nodoc:*
* new ActionVersion(options)
@@ -22,8 +22,8 @@ var $$ = require('../const');
**/
var ActionVersion = module.exports = function ActionVersion(options) {
options = options || {};
- options.defaultValue = (!!options.defaultValue ? options.defaultValue: $$.SUPPRESS);
- options.dest = (options.dest || $$.SUPPRESS);
+ options.defaultValue = (options.defaultValue ? options.defaultValue : c.SUPPRESS);
+ options.dest = (options.dest || c.SUPPRESS);
options.nargs = 0;
this.version = options.version;
Action.call(this, options);
diff --git a/tools/eslint/node_modules/argparse/lib/action_container.js b/tools/eslint/node_modules/argparse/lib/action_container.js
index 043ead410f..93a47b2936 100644
--- a/tools/eslint/node_modules/argparse/lib/action_container.js
+++ b/tools/eslint/node_modules/argparse/lib/action_container.js
@@ -7,10 +7,11 @@
'use strict';
var format = require('util').format;
-var _ = require('lodash');
// Constants
-var $$ = require('./const');
+var c = require('./const');
+
+var $$ = require('./utils');
//Actions
var ActionHelp = require('./action/help');
@@ -27,8 +28,6 @@ var ActionSubparsers = require('./action/subparsers');
// Errors
var argumentErrorHelper = require('./argument/error');
-
-
/**
* new ActionContainer(options)
*
@@ -110,7 +109,7 @@ ActionContainer.prototype.register = function (registryName, value, object) {
};
ActionContainer.prototype._registryGet = function (registryName, value, defaultValue) {
- if (3 > arguments.length) {
+ if (arguments.length < 3) {
defaultValue = null;
}
return this._registries[registryName][value] || defaultValue;
@@ -129,13 +128,15 @@ ActionContainer.prototype._registryGet = function (registryName, value, defaultV
ActionContainer.prototype.setDefaults = function (options) {
options = options || {};
for (var property in options) {
- this._defaults[property] = options[property];
+ if ($$.has(options, property)) {
+ this._defaults[property] = options[property];
+ }
}
// if these defaults match any existing arguments, replace the previous
// default on the object with the new one
this._actions.forEach(function (action) {
- if (action.dest in options) {
+ if ($$.has(options, action.dest)) {
action.defaultValue = options[action.dest];
}
});
@@ -148,10 +149,10 @@ ActionContainer.prototype.setDefaults = function (options) {
* Return action default value
**/
ActionContainer.prototype.getDefault = function (dest) {
- var result = (_.has(this._defaults, dest)) ? this._defaults[dest] : null;
+ var result = $$.has(this._defaults, dest) ? this._defaults[dest] : null;
this._actions.forEach(function (action) {
- if (action.dest === dest && _.has(action, 'defaultValue')) {
+ if (action.dest === dest && $$.has(action, 'defaultValue')) {
result = action.defaultValue;
}
});
@@ -175,10 +176,10 @@ ActionContainer.prototype.addArgument = function (args, options) {
args = args;
options = options || {};
- if (!_.isArray(args)) {
+ if (!Array.isArray(args)) {
throw new TypeError('addArgument first argument should be an array');
}
- if (!_.isObject(options) || _.isArray(options)) {
+ if (typeof options !== 'object' || Array.isArray(options)) {
throw new TypeError('addArgument second argument should be a hash');
}
@@ -196,25 +197,25 @@ ActionContainer.prototype.addArgument = function (args, options) {
}
// if no default was supplied, use the parser-level default
- if (_.isUndefined(options.defaultValue)) {
+ if (typeof options.defaultValue === 'undefined') {
var dest = options.dest;
- if (_.has(this._defaults, dest)) {
+ if ($$.has(this._defaults, dest)) {
options.defaultValue = this._defaults[dest];
- } else if (!_.isUndefined(this.argumentDefault)) {
+ } else if (typeof this.argumentDefault !== 'undefined') {
options.defaultValue = this.argumentDefault;
}
}
// create the action object, and add it to the parser
var ActionClass = this._popActionClass(options);
- if (! _.isFunction(ActionClass)) {
+ if (typeof ActionClass !== 'function') {
throw new Error(format('Unknown action "%s".', ActionClass));
}
var action = new ActionClass(options);
// throw an error if the action type is not callable
var typeFunction = this._registryGet('type', action.type, action.type);
- if (!_.isFunction(typeFunction)) {
+ if (typeof typeFunction !== 'function') {
throw new Error(format('"%s" is not callable', typeFunction));
}
@@ -263,7 +264,7 @@ ActionContainer.prototype._addAction = function (action) {
// set the flag if any option strings look like negative numbers
action.optionStrings.forEach(function (optionString) {
if (optionString.match(self._regexpNegativeNumber)) {
- if (!_.any(self._hasNegativeNumberOptionals)) {
+ if (!self._hasNegativeNumberOptionals.some(Boolean)) {
self._hasNegativeNumberOptionals.push(true);
}
}
@@ -329,19 +330,17 @@ ActionContainer.prototype._addContainerActions = function (container) {
// add all actions to this container or their group
container._actions.forEach(function (action) {
var key = actionHash(action);
- if (!!groupMap[key]) {
+ if (groupMap[key]) {
groupMap[key]._addAction(action);
- }
- else
- {
+ } else {
this._addAction(action);
}
});
};
ActionContainer.prototype._getPositional = function (dest, options) {
- if (_.isArray(dest)) {
- dest = _.first(dest);
+ if (Array.isArray(dest)) {
+ dest = dest[0];
}
// make sure required is not specified
if (options.required) {
@@ -350,10 +349,10 @@ ActionContainer.prototype._getPositional = function (dest, options) {
// mark positional arguments as required if at least one is
// always required
- if (options.nargs !== $$.OPTIONAL && options.nargs !== $$.ZERO_OR_MORE) {
+ if (options.nargs !== c.OPTIONAL && options.nargs !== c.ZERO_OR_MORE) {
options.required = true;
}
- if (options.nargs === $$.ZERO_OR_MORE && options.defaultValue === undefined) {
+ if (options.nargs === c.ZERO_OR_MORE && typeof options.defaultValue === 'undefined') {
options.required = true;
}
@@ -390,8 +389,8 @@ ActionContainer.prototype._getOptional = function (args, options) {
delete options.dest;
if (!dest) {
- var optionStringDest = optionStringsLong.length ? optionStringsLong[0] :optionStrings[0];
- dest = _.trim(optionStringDest, this.prefixChars);
+ var optionStringDest = optionStringsLong.length ? optionStringsLong[0] : optionStrings[0];
+ dest = $$.trimChars(optionStringDest, this.prefixChars);
if (dest.length === 0) {
throw new Error(
@@ -420,10 +419,10 @@ ActionContainer.prototype._popActionClass = function (options, defaultValue) {
ActionContainer.prototype._getHandler = function () {
var handlerString = this.conflictHandler;
- var handlerFuncName = "_handleConflict" + _.capitalize(handlerString);
+ var handlerFuncName = '_handleConflict' + $$.capitalize(handlerString);
var func = this[handlerFuncName];
if (typeof func === 'undefined') {
- var msg = "invalid conflict resolution value: " + handlerString;
+ var msg = 'invalid conflict resolution value: ' + handlerString;
throw new Error(msg);
} else {
return func;
@@ -439,7 +438,7 @@ ActionContainer.prototype._checkConflict = function (action) {
action.optionStrings.forEach(function (optionString) {
var conflOptional = optionStringActions[optionString];
if (typeof conflOptional !== 'undefined') {
- conflictOptionals.push([optionString, conflOptional]);
+ conflictOptionals.push([ optionString, conflOptional ]);
}
});
@@ -450,7 +449,7 @@ ActionContainer.prototype._checkConflict = function (action) {
};
ActionContainer.prototype._handleConflictError = function (action, conflOptionals) {
- var conflicts = _.map(conflOptionals, function (pair) {return pair[0]; });
+ var conflicts = conflOptionals.map(function (pair) { return pair[0]; });
conflicts = conflicts.join(', ');
throw argumentErrorHelper(
action,
diff --git a/tools/eslint/node_modules/argparse/lib/argument_parser.js b/tools/eslint/node_modules/argparse/lib/argument_parser.js
index c429ca929b..eca1ad685e 100644
--- a/tools/eslint/node_modules/argparse/lib/argument_parser.js
+++ b/tools/eslint/node_modules/argparse/lib/argument_parser.js
@@ -10,12 +10,12 @@
var util = require('util');
var format = require('util').format;
var Path = require('path');
-
-var _ = require('lodash');
var sprintf = require('sprintf-js').sprintf;
// Constants
-var $$ = require('./const');
+var c = require('./const');
+
+var $$ = require('./utils');
var ActionContainer = require('./action_container');
@@ -52,7 +52,7 @@ var Namespace = require('./namespace');
*
* [1]:http://docs.python.org/dev/library/argparse.html#argumentparser-objects
**/
-var ArgumentParser = module.exports = function ArgumentParser(options) {
+function ArgumentParser(options) {
if (!(this instanceof ArgumentParser)) {
return new ArgumentParser(options);
}
@@ -65,8 +65,8 @@ var ArgumentParser = module.exports = function ArgumentParser(options) {
options.conflictHandler = (options.conflictHandler || 'error');
ActionContainer.call(this, options);
- options.addHelp = (options.addHelp === undefined || !!options.addHelp);
- options.parents = (options.parents || []);
+ options.addHelp = typeof options.addHelp === 'undefined' || !!options.addHelp;
+ options.parents = options.parents || [];
// default program name
options.prog = (options.prog || Path.basename(process.argv[1]));
this.prog = options.prog;
@@ -78,14 +78,14 @@ var ArgumentParser = module.exports = function ArgumentParser(options) {
this.formatterClass = (options.formatterClass || HelpFormatter);
this.fromfilePrefixChars = options.fromfilePrefixChars || null;
- this._positionals = this.addArgumentGroup({title: 'Positional arguments'});
- this._optionals = this.addArgumentGroup({title: 'Optional arguments'});
+ this._positionals = this.addArgumentGroup({ title: 'Positional arguments' });
+ this._optionals = this.addArgumentGroup({ title: 'Optional arguments' });
this._subparsers = null;
// register types
- var FUNCTION_IDENTITY = function (o) {
+ function FUNCTION_IDENTITY(o) {
return o;
- };
+ }
this.register('type', 'auto', FUNCTION_IDENTITY);
this.register('type', null, FUNCTION_IDENTITY);
this.register('type', 'int', function (x) {
@@ -110,21 +110,21 @@ var ArgumentParser = module.exports = function ArgumentParser(options) {
var defaultPrefix = (this.prefixChars.indexOf('-') > -1) ? '-' : this.prefixChars[0];
if (options.addHelp) {
this.addArgument(
- [defaultPrefix + 'h', defaultPrefix + defaultPrefix + 'help'],
+ [ defaultPrefix + 'h', defaultPrefix + defaultPrefix + 'help' ],
{
action: 'help',
- defaultValue: $$.SUPPRESS,
+ defaultValue: c.SUPPRESS,
help: 'Show this help message and exit.'
}
);
}
- if (this.version !== undefined) {
+ if (typeof this.version !== 'undefined') {
this.addArgument(
- [defaultPrefix + 'v', defaultPrefix + defaultPrefix + 'version'],
+ [ defaultPrefix + 'v', defaultPrefix + defaultPrefix + 'version' ],
{
action: 'version',
version: this.version,
- defaultValue: $$.SUPPRESS,
+ defaultValue: c.SUPPRESS,
help: "Show program's version number and exit."
}
);
@@ -133,7 +133,7 @@ var ArgumentParser = module.exports = function ArgumentParser(options) {
// add parent arguments and defaults
options.parents.forEach(function (parent) {
self._addContainerActions(parent);
- if (parent._defaults !== undefined) {
+ if (typeof parent._defaults !== 'undefined') {
for (var defaultKey in parent._defaults) {
if (parent._defaults.hasOwnProperty(defaultKey)) {
self._defaults[defaultKey] = parent._defaults[defaultKey];
@@ -141,8 +141,8 @@ var ArgumentParser = module.exports = function ArgumentParser(options) {
}
}
});
+}
-};
util.inherits(ArgumentParser, ActionContainer);
/**
@@ -154,7 +154,7 @@ util.inherits(ArgumentParser, ActionContainer);
* [1]:http://docs.python.org/dev/library/argparse.html#sub-commands
**/
ArgumentParser.prototype.addSubparsers = function (options) {
- if (!!this._subparsers) {
+ if (this._subparsers) {
this.error('Cannot have multiple subparser arguments.');
}
@@ -184,7 +184,7 @@ ArgumentParser.prototype.addSubparsers = function (options) {
var positionals = this._getPositionalActions();
var groups = this._mutuallyExclusiveGroups;
formatter.addUsage(this.usage, positionals, groups, '');
- options.prog = _.trim(formatter.formatHelp());
+ options.prog = formatter.formatHelp().trim();
}
// create the parsers action and add it to the positionals list
@@ -265,11 +265,11 @@ ArgumentParser.prototype.parseKnownArgs = function (args, namespace) {
namespace = namespace || new Namespace();
self._actions.forEach(function (action) {
- if (action.dest !== $$.SUPPRESS) {
- if (!_.has(namespace, action.dest)) {
- if (action.defaultValue !== $$.SUPPRESS) {
+ if (action.dest !== c.SUPPRESS) {
+ if (!$$.has(namespace, action.dest)) {
+ if (action.defaultValue !== c.SUPPRESS) {
var defaultValue = action.defaultValue;
- if (_.isString(action.defaultValue)) {
+ if (typeof action.defaultValue === 'string') {
defaultValue = self._getValue(action, defaultValue);
}
namespace[action.dest] = defaultValue;
@@ -278,7 +278,7 @@ ArgumentParser.prototype.parseKnownArgs = function (args, namespace) {
}
});
- _.keys(self._defaults).forEach(function (dest) {
+ Object.keys(self._defaults).forEach(function (dest) {
namespace[dest] = self._defaults[dest];
});
@@ -288,11 +288,11 @@ ArgumentParser.prototype.parseKnownArgs = function (args, namespace) {
namespace = res[0];
args = res[1];
- if (_.has(namespace, $$._UNRECOGNIZED_ARGS_ATTR)) {
- args = _.union(args, namespace[$$._UNRECOGNIZED_ARGS_ATTR]);
- delete namespace[$$._UNRECOGNIZED_ARGS_ATTR];
+ if ($$.has(namespace, c._UNRECOGNIZED_ARGS_ATTR)) {
+ args = $$.arrayUnion(args, namespace[c._UNRECOGNIZED_ARGS_ATTR]);
+ delete namespace[c._UNRECOGNIZED_ARGS_ATTR];
}
- return [namespace, args];
+ return [ namespace, args ];
} catch (e) {
this.error(e);
}
@@ -326,7 +326,7 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
this._mutuallyExclusiveGroups.forEach(function (mutexGroup) {
mutexGroup._groupActions.forEach(function (mutexAction, i, groupActions) {
key = actionHash(mutexAction);
- if (!_.has(actionConflicts, key)) {
+ if (!$$.has(actionConflicts, key)) {
actionConflicts[key] = [];
}
conflicts = actionConflicts[key];
@@ -349,16 +349,14 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
argStringPatternParts.push('A');
argStringIndex++;
}
- }
- // otherwise, add the arg to the arg strings
- // and note the index if it was an option
- else {
+ } else {
+ // otherwise, add the arg to the arg strings
+ // and note the index if it was an option
var pattern;
var optionTuple = self._parseOptional(argString);
if (!optionTuple) {
pattern = 'A';
- }
- else {
+ } else {
optionStringIndices[argStringIndex] = optionTuple;
pattern = 'O';
}
@@ -380,7 +378,7 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
// value don't really count as "present"
if (argumentValues !== action.defaultValue) {
seenNonDefaultActions.push(action);
- if (!!actionConflicts[actionHash(action)]) {
+ if (actionConflicts[actionHash(action)]) {
actionConflicts[actionHash(action)].forEach(function (actionConflict) {
if (seenNonDefaultActions.indexOf(actionConflict) >= 0) {
throw argumentErrorHelper(
@@ -392,7 +390,7 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
}
}
- if (argumentValues !== $$.SUPPRESS) {
+ if (argumentValues !== c.SUPPRESS) {
action.call(self, namespace, argumentValues, optionString);
}
}
@@ -410,12 +408,12 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
var args, argCount, start, stop;
- while (true) {
+ for (;;) {
if (!action) {
extras.push(argStrings[startIndex]);
return startIndex + 1;
}
- if (!!explicitArg) {
+ if (explicitArg) {
argCount = self._matchArgument(action, 'A');
// if the action is a single-dash option and takes no
@@ -423,39 +421,33 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
// of the tail of the option string
var chars = self.prefixChars;
if (argCount === 0 && chars.indexOf(optionString[1]) < 0) {
- actionTuples.push([action, [], optionString]);
+ actionTuples.push([ action, [], optionString ]);
optionString = optionString[0] + explicitArg[0];
var newExplicitArg = explicitArg.slice(1) || null;
var optionalsMap = self._optionStringActions;
- if (_.keys(optionalsMap).indexOf(optionString) >= 0) {
+ if (Object.keys(optionalsMap).indexOf(optionString) >= 0) {
action = optionalsMap[optionString];
explicitArg = newExplicitArg;
+ } else {
+ throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg));
}
- else {
- var msg = 'ignored explicit argument %r';
- throw argumentErrorHelper(action, msg);
- }
- }
- // if the action expect exactly one argument, we've
- // successfully matched the option; exit the loop
- else if (argCount === 1) {
+ } else if (argCount === 1) {
+ // if the action expect exactly one argument, we've
+ // successfully matched the option; exit the loop
stop = startIndex + 1;
- args = [explicitArg];
- actionTuples.push([action, args, optionString]);
+ args = [ explicitArg ];
+ actionTuples.push([ action, args, optionString ]);
break;
+ } else {
+ // error if a double-dash option did not use the
+ // explicit argument
+ throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg));
}
- // error if a double-dash option did not use the
- // explicit argument
- else {
- var message = 'ignored explicit argument %r';
- throw argumentErrorHelper(action, sprintf(message, explicitArg));
- }
- }
- // if there is no explicit argument, try to match the
- // optional's string arguments with the following strings
- // if successful, exit the loop
- else {
+ } else {
+ // if there is no explicit argument, try to match the
+ // optional's string arguments with the following strings
+ // if successful, exit the loop
start = startIndex + 1;
var selectedPatterns = argStringsPattern.substr(start);
@@ -466,7 +458,7 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
args = argStrings.slice(start, stop);
- actionTuples.push([action, args, optionString]);
+ actionTuples.push([ action, args, optionString ]);
break;
}
@@ -494,17 +486,17 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
// slice off the appropriate arg strings for each Positional
// and add the Positional and its args to the list
- _.zip(positionals, argCounts).forEach(function (item) {
- var action = item[0];
- var argCount = item[1];
- if (argCount === undefined) {
- return;
- }
- var args = argStrings.slice(startIndex, startIndex + argCount);
+ for (var i = 0; i < positionals.length; i++) {
+ var action = positionals[i];
+ var argCount = argCounts[i];
+ if (typeof argCount === 'undefined') {
+ continue;
+ }
+ var args = argStrings.slice(startIndex, startIndex + argCount);
- startIndex += argCount;
- takeAction(action, args);
- });
+ startIndex += argCount;
+ takeAction(action, args);
+ }
// slice off the Positionals that we just parsed and return the
// index at which the Positionals' string args stopped
@@ -535,8 +527,7 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
if (position >= startIndex) {
if (nextOptionStringIndex !== null) {
nextOptionStringIndex = Math.min(nextOptionStringIndex, position);
- }
- else {
+ } else {
nextOptionStringIndex = position;
}
}
@@ -549,8 +540,7 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
if (positionalsEndIndex > startIndex) {
startIndex = positionalsEndIndex;
continue;
- }
- else {
+ } else {
startIndex = positionalsEndIndex;
}
}
@@ -581,7 +571,7 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
// make sure all required actions were present
self._actions.forEach(function (action) {
if (action.required) {
- if (_.indexOf(seenActions, action) < 0) {
+ if (seenActions.indexOf(action) < 0) {
self.error(format('Argument "%s" is required', action.getName()));
}
}
@@ -591,15 +581,15 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
var actionUsed = false;
self._mutuallyExclusiveGroups.forEach(function (group) {
if (group.required) {
- actionUsed = _.any(group._groupActions, function (action) {
- return _.contains(seenNonDefaultActions, action);
+ actionUsed = group._groupActions.some(function (action) {
+ return seenNonDefaultActions.indexOf(action) !== -1;
});
// if no actions were used, report the error
if (!actionUsed) {
var names = [];
group._groupActions.forEach(function (action) {
- if (action.help !== $$.SUPPRESS) {
+ if (action.help !== c.SUPPRESS) {
names.push(action.getName());
}
});
@@ -611,16 +601,16 @@ ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
});
// return the updated namespace and the extra arguments
- return [namespace, extras];
+ return [ namespace, extras ];
};
ArgumentParser.prototype._readArgsFromFiles = function (argStrings) {
// expand arguments referencing files
- var _this = this;
+ var self = this;
var fs = require('fs');
var newArgStrings = [];
argStrings.forEach(function (argString) {
- if (_this.fromfilePrefixChars.indexOf(argString[0]) < 0) {
+ if (self.fromfilePrefixChars.indexOf(argString[0]) < 0) {
// for regular arguments, just add them back into the list
newArgStrings.push(argString);
} else {
@@ -631,14 +621,14 @@ ArgumentParser.prototype._readArgsFromFiles = function (argStrings) {
var content = fs.readFileSync(filename, 'utf8');
content = content.trim().split('\n');
content.forEach(function (argLine) {
- _this.convertArgLineToArgs(argLine).forEach(function (arg) {
+ self.convertArgLineToArgs(argLine).forEach(function (arg) {
argstrs.push(arg);
});
- argstrs = _this._readArgsFromFiles(argstrs);
+ argstrs = self._readArgsFromFiles(argstrs);
});
newArgStrings.push.apply(newArgStrings, argstrs);
} catch (error) {
- return _this.error(error.message);
+ return self.error(error.message);
}
}
});
@@ -646,7 +636,7 @@ ArgumentParser.prototype._readArgsFromFiles = function (argStrings) {
};
ArgumentParser.prototype.convertArgLineToArgs = function (argLine) {
- return [argLine];
+ return [ argLine ];
};
ArgumentParser.prototype._matchArgument = function (action, regexpArgStrings) {
@@ -659,14 +649,15 @@ ArgumentParser.prototype._matchArgument = function (action, regexpArgStrings) {
// throw an exception if we weren't able to find a match
if (!matches) {
switch (action.nargs) {
+ /*eslint-disable no-undefined*/
case undefined:
case null:
message = 'Expected one argument.';
break;
- case $$.OPTIONAL:
+ case c.OPTIONAL:
message = 'Expected at most one argument.';
break;
- case $$.ONE_OR_MORE:
+ case c.ONE_OR_MORE:
message = 'Expected at least one argument.';
break;
default:
@@ -690,9 +681,9 @@ ArgumentParser.prototype._matchArgumentsPartial = function (actions, regexpArgSt
var actionSlice, pattern, matches;
var i, j;
- var getLength = function (string) {
+ function getLength(string) {
return string.length;
- };
+ }
for (i = actions.length; i > 0; i--) {
pattern = '';
@@ -730,8 +721,8 @@ ArgumentParser.prototype._parseOptional = function (argString) {
}
// if the option string is present in the parser, return the action
- if (!!this._optionStringActions[argString]) {
- return [this._optionStringActions[argString], argString, null];
+ if (this._optionStringActions[argString]) {
+ return [ this._optionStringActions[argString], argString, null ];
}
// if it's just a single character, it was meant to be positional
@@ -744,9 +735,9 @@ ArgumentParser.prototype._parseOptional = function (argString) {
optionString = argString.split('=', 1)[0];
argExplicit = argString.slice(optionString.length + 1);
- if (!!this._optionStringActions[optionString]) {
+ if (this._optionStringActions[optionString]) {
action = this._optionStringActions[optionString];
- return [action, optionString, argExplicit];
+ return [ action, optionString, argExplicit ];
}
}
@@ -773,7 +764,7 @@ ArgumentParser.prototype._parseOptional = function (argString) {
// number, it was meant to be positional
// unless there are negative-number-like options
if (argString.match(this._regexpNegativeNumber)) {
- if (!_.any(this._hasNegativeNumberOptionals)) {
+ if (!this._hasNegativeNumberOptionals.some(Boolean)) {
return null;
}
}
@@ -784,7 +775,7 @@ ArgumentParser.prototype._parseOptional = function (argString) {
// it was meant to be an optional but there is no such option
// in this parser (though it might be a valid option in a subparser)
- return [null, argString, null];
+ return [ null, argString, null ];
};
ArgumentParser.prototype._getOptionTuples = function (optionString) {
@@ -811,7 +802,7 @@ ArgumentParser.prototype._getOptionTuples = function (optionString) {
for (actionOptionString in this._optionStringActions) {
if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) {
action = this._optionStringActions[actionOptionString];
- result.push([action, actionOptionString, argExplicit]);
+ result.push([ action, actionOptionString, argExplicit ]);
}
}
@@ -825,11 +816,13 @@ ArgumentParser.prototype._getOptionTuples = function (optionString) {
var argExplicitShort = optionString.substr(2);
for (actionOptionString in this._optionStringActions) {
+ if (!$$.has(this._optionStringActions, actionOptionString)) continue;
+
action = this._optionStringActions[actionOptionString];
if (actionOptionString === optionPrefixShort) {
- result.push([action, actionOptionString, argExplicitShort]);
+ result.push([ action, actionOptionString, argExplicitShort ]);
} else if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) {
- result.push([action, actionOptionString, argExplicit]);
+ result.push([ action, actionOptionString, argExplicit ]);
}
}
@@ -853,28 +846,28 @@ ArgumentParser.prototype._getNargsPattern = function (action) {
regexpNargs = '(-*A-*)';
break;
// allow zero or more arguments
- case $$.OPTIONAL:
+ case c.OPTIONAL:
regexpNargs = '(-*A?-*)';
break;
// allow zero or more arguments
- case $$.ZERO_OR_MORE:
+ case c.ZERO_OR_MORE:
regexpNargs = '(-*[A-]*)';
break;
// allow one or more arguments
- case $$.ONE_OR_MORE:
+ case c.ONE_OR_MORE:
regexpNargs = '(-*A[A-]*)';
break;
// allow any number of options or arguments
- case $$.REMAINDER:
+ case c.REMAINDER:
regexpNargs = '([-AO]*)';
break;
// allow one argument followed by any number of options or arguments
- case $$.PARSER:
+ case c.PARSER:
regexpNargs = '(-*A[-AO]*)';
break;
// all others should be integers
default:
- regexpNargs = '(-*' + _.repeat('-*A', action.nargs) + '-*)';
+ regexpNargs = '(-*' + $$.repeat('-*A', action.nargs) + '-*)';
}
// if this is an optional action, -- is not allowed
@@ -895,7 +888,7 @@ ArgumentParser.prototype._getValues = function (action, argStrings) {
var self = this;
// for everything but PARSER args, strip out '--'
- if (action.nargs !== $$.PARSER && action.nargs !== $$.REMAINDER) {
+ if (action.nargs !== c.PARSER && action.nargs !== c.REMAINDER) {
argStrings = argStrings.filter(function (arrayElement) {
return arrayElement !== '--';
});
@@ -904,18 +897,18 @@ ArgumentParser.prototype._getValues = function (action, argStrings) {
var value, argString;
// optional argument produces a default when not present
- if (argStrings.length === 0 && action.nargs === $$.OPTIONAL) {
+ if (argStrings.length === 0 && action.nargs === c.OPTIONAL) {
- value = (action.isOptional()) ? action.constant: action.defaultValue;
+ value = (action.isOptional()) ? action.constant : action.defaultValue;
- if (typeof(value) === 'string') {
+ if (typeof (value) === 'string') {
value = this._getValue(action, value);
this._checkValue(action, value);
}
// when nargs='*' on a positional, if there were no command-line
// args, use the default if it is anything other than None
- } else if (argStrings.length === 0 && action.nargs === $$.ZERO_OR_MORE &&
+ } else if (argStrings.length === 0 && action.nargs === c.ZERO_OR_MORE &&
action.optionStrings.length === 0) {
value = (action.defaultValue || argStrings);
@@ -923,20 +916,20 @@ ArgumentParser.prototype._getValues = function (action, argStrings) {
// single argument or optional argument produces a single value
} else if (argStrings.length === 1 &&
- (!action.nargs || action.nargs === $$.OPTIONAL)) {
+ (!action.nargs || action.nargs === c.OPTIONAL)) {
argString = argStrings[0];
value = this._getValue(action, argString);
this._checkValue(action, value);
// REMAINDER arguments convert all values, checking none
- } else if (action.nargs === $$.REMAINDER) {
+ } else if (action.nargs === c.REMAINDER) {
value = argStrings.map(function (v) {
return self._getValue(action, v);
});
// PARSER arguments convert all values, but check only the first
- } else if (action.nargs === $$.PARSER) {
+ } else if (action.nargs === c.PARSER) {
value = argStrings.map(function (v) {
return self._getValue(action, v);
});
@@ -960,7 +953,7 @@ ArgumentParser.prototype._getValue = function (action, argString) {
var result;
var typeFunction = this._registryGet('type', action.type, action.type);
- if (!_.isFunction(typeFunction)) {
+ if (typeof typeFunction !== 'function') {
var message = format('%s is not callable', typeFunction);
throw argumentErrorHelper(action, message);
}
@@ -975,13 +968,13 @@ ArgumentParser.prototype._getValue = function (action, argString) {
// Failing that, include the error message it raised.
} catch (e) {
var name = null;
- if (_.isString(action.type)) {
+ if (typeof action.type === 'string') {
name = action.type;
} else {
name = action.type.name || action.type.displayName || '<function>';
}
var msg = format('Invalid %s value: %s', name, argString);
- if (name === '<function>') {msg += '\n' + e.message; }
+ if (name === '<function>') { msg += '\n' + e.message; }
throw argumentErrorHelper(action, msg);
}
// return the converted value
@@ -991,25 +984,23 @@ ArgumentParser.prototype._getValue = function (action, argString) {
ArgumentParser.prototype._checkValue = function (action, value) {
// converted value must be one of the choices (if specified)
var choices = action.choices;
- if (!!choices) {
+ if (choices) {
// choise for argument can by array or string
- if ((_.isString(choices) || _.isArray(choices)) &&
+ if ((typeof choices === 'string' || Array.isArray(choices)) &&
choices.indexOf(value) !== -1) {
return;
}
// choise for subparsers can by only hash
- if (_.isObject(choices) && !_.isArray(choices) && choices[value]) {
+ if (typeof choices === 'object' && !Array.isArray(choices) && choices[value]) {
return;
}
- if (_.isString(choices)) {
+ if (typeof choices === 'string') {
choices = choices.split('').join(', ');
- }
- else if (_.isArray(choices)) {
+ } else if (Array.isArray(choices)) {
choices = choices.join(', ');
- }
- else {
- choices = _.keys(choices).join(', ');
+ } else {
+ choices = Object.keys(choices).join(', ');
}
var message = format('Invalid choice: %s (choose from [%s])', value, choices);
throw argumentErrorHelper(action, message);
@@ -1070,7 +1061,7 @@ ArgumentParser.prototype.formatHelp = function () {
ArgumentParser.prototype._getFormatter = function () {
var FormatterClass = this.formatterClass;
- var formatter = new FormatterClass({prog: this.prog});
+ var formatter = new FormatterClass({ prog: this.prog });
return formatter;
};
@@ -1125,11 +1116,10 @@ ArgumentParser.prototype._printMessage = function (message, stream) {
* Print message in stderr/stdout and exit program
**/
ArgumentParser.prototype.exit = function (status, message) {
- if (!!message) {
+ if (message) {
if (status === 0) {
this._printMessage(message);
- }
- else {
+ } else {
this._printMessage(message, process.stderr);
}
}
@@ -1154,11 +1144,10 @@ ArgumentParser.prototype.error = function (err) {
throw err;
}
message = err.message;
- }
- else {
+ } else {
message = err;
}
- var msg = format('%s: error: %s', this.prog, message) + $$.EOL;
+ var msg = format('%s: error: %s', this.prog, message) + c.EOL;
if (this.debug === true) {
throw new Error(msg);
@@ -1168,3 +1157,5 @@ ArgumentParser.prototype.error = function (err) {
return this.exit(2, msg);
};
+
+module.exports = ArgumentParser;
diff --git a/tools/eslint/node_modules/argparse/lib/const.js b/tools/eslint/node_modules/argparse/lib/const.js
index de831ba4e9..b1fd4ced4e 100644
--- a/tools/eslint/node_modules/argparse/lib/const.js
+++ b/tools/eslint/node_modules/argparse/lib/const.js
@@ -1,6 +1,9 @@
//
// Constants
//
+
+'use strict';
+
module.exports.EOL = '\n';
module.exports.SUPPRESS = '==SUPPRESS==';
diff --git a/tools/eslint/node_modules/argparse/lib/help/added_formatters.js b/tools/eslint/node_modules/argparse/lib/help/added_formatters.js
index 3c99c4a1fc..f0fbe5da85 100644
--- a/tools/eslint/node_modules/argparse/lib/help/added_formatters.js
+++ b/tools/eslint/node_modules/argparse/lib/help/added_formatters.js
@@ -1,12 +1,11 @@
'use strict';
var util = require('util');
-var _ = require('lodash');
-
// Constants
-var $$ = require('../const');
+var c = require('../const');
+var $$ = require('../utils');
var HelpFormatter = require('./formatter.js');
/**
@@ -19,17 +18,17 @@ var HelpFormatter = require('./formatter.js');
* provided by the class are considered an implementation detail.
**/
-var ArgumentDefaultsHelpFormatter = function ArgumentDefaultsHelpFormatter(options) {
+function ArgumentDefaultsHelpFormatter(options) {
HelpFormatter.call(this, options);
-};
+}
util.inherits(ArgumentDefaultsHelpFormatter, HelpFormatter);
ArgumentDefaultsHelpFormatter.prototype._getHelpString = function (action) {
var help = action.help;
if (action.help.indexOf('%(defaultValue)s') === -1) {
- if (action.defaultValue !== $$.SUPPRESS) {
- var defaulting_nargs = [$$.OPTIONAL, $$.ZERO_OR_MORE];
+ if (action.defaultValue !== c.SUPPRESS) {
+ var defaulting_nargs = [ c.OPTIONAL, c.ZERO_OR_MORE ];
if (action.isOptional() || (defaulting_nargs.indexOf(action.nargs) >= 0)) {
help += ' (default: %(defaultValue)s)';
}
@@ -50,16 +49,16 @@ module.exports.ArgumentDefaultsHelpFormatter = ArgumentDefaultsHelpFormatter;
* provided by the class are considered an implementation detail.
**/
-var RawDescriptionHelpFormatter = function RawDescriptionHelpFormatter(options) {
+function RawDescriptionHelpFormatter(options) {
HelpFormatter.call(this, options);
-};
+}
util.inherits(RawDescriptionHelpFormatter, HelpFormatter);
RawDescriptionHelpFormatter.prototype._fillText = function (text, width, indent) {
var lines = text.split('\n');
lines = lines.map(function (line) {
- return _.trimRight(indent + line);
+ return $$.trimEnd(indent + line);
});
return lines.join('\n');
};
@@ -75,9 +74,9 @@ module.exports.RawDescriptionHelpFormatter = RawDescriptionHelpFormatter;
* provided by the class are considered an implementation detail.
**/
-var RawTextHelpFormatter = function RawTextHelpFormatter(options) {
+function RawTextHelpFormatter(options) {
RawDescriptionHelpFormatter.call(this, options);
-};
+}
util.inherits(RawTextHelpFormatter, RawDescriptionHelpFormatter);
diff --git a/tools/eslint/node_modules/argparse/lib/help/formatter.js b/tools/eslint/node_modules/argparse/lib/help/formatter.js
index e050728e3e..61c4f41344 100644
--- a/tools/eslint/node_modules/argparse/lib/help/formatter.js
+++ b/tools/eslint/node_modules/argparse/lib/help/formatter.js
@@ -13,11 +13,12 @@
**/
'use strict';
-var _ = require('lodash');
var sprintf = require('sprintf-js').sprintf;
// Constants
-var $$ = require('../const');
+var c = require('../const');
+
+var $$ = require('../utils');
/*:nodoc:* internal
@@ -53,7 +54,7 @@ Section.prototype.formatHelp = function (formatter) {
var itemHelp, heading;
// format the indented section
- if (!!this._parent) {
+ if (this._parent) {
formatter._indent();
}
@@ -67,7 +68,7 @@ Section.prototype.formatHelp = function (formatter) {
});
itemHelp = formatter._joinParts(itemHelp);
- if (!!this._parent) {
+ if (this._parent) {
formatter._dedent();
}
@@ -78,13 +79,13 @@ Section.prototype.formatHelp = function (formatter) {
// add the heading if the section was non-empty
heading = '';
- if (!!this._heading && this._heading !== $$.SUPPRESS) {
+ if (this._heading && this._heading !== c.SUPPRESS) {
var currentIndent = formatter.currentIndent;
- heading = _.repeat(' ', currentIndent) + this._heading + ':' + $$.EOL;
+ heading = $$.repeat(' ', currentIndent) + this._heading + ':' + c.EOL;
}
// join the section-initialize newline, the heading and the help
- return formatter._joinParts([$$.EOL, heading, itemHelp, $$.EOL]);
+ return formatter._joinParts([ c.EOL, heading, itemHelp, c.EOL ]);
};
/**
@@ -114,7 +115,7 @@ var HelpFormatter = module.exports = function HelpFormatter(options) {
this._currentSection = this._rootSection;
this._whitespaceMatcher = new RegExp('\\s+', 'g');
- this._longBreakMatcher = new RegExp($$.EOL + $$.EOL + $$.EOL + '+', 'g');
+ this._longBreakMatcher = new RegExp(c.EOL + c.EOL + c.EOL + '+', 'g');
};
HelpFormatter.prototype._indent = function () {
@@ -131,7 +132,7 @@ HelpFormatter.prototype._dedent = function () {
};
HelpFormatter.prototype._addItem = function (func, args) {
- this._currentSection.addItem([func, args]);
+ this._currentSection.addItem([ func, args ]);
};
//
@@ -158,7 +159,7 @@ HelpFormatter.prototype.startSection = function (heading) {
this._indent();
var section = new Section(this._currentSection, heading);
var func = section.formatHelp.bind(section);
- this._addItem(func, [this]);
+ this._addItem(func, [ this ]);
this._currentSection = section;
};
@@ -194,8 +195,8 @@ HelpFormatter.prototype.endSection = function () {
*
**/
HelpFormatter.prototype.addText = function (text) {
- if (!!text && text !== $$.SUPPRESS) {
- this._addItem(this._formatText, [text]);
+ if (text && text !== c.SUPPRESS) {
+ this._addItem(this._formatText, [ text ]);
}
};
@@ -215,8 +216,8 @@ HelpFormatter.prototype.addText = function (text) {
*
**/
HelpFormatter.prototype.addUsage = function (usage, actions, groups, prefix) {
- if (usage !== $$.SUPPRESS) {
- this._addItem(this._formatUsage, [usage, actions, groups, prefix]);
+ if (usage !== c.SUPPRESS) {
+ this._addItem(this._formatUsage, [ usage, actions, groups, prefix ]);
}
};
@@ -229,16 +230,16 @@ HelpFormatter.prototype.addUsage = function (usage, actions, groups, prefix) {
* Single variant of [[HelpFormatter#addArguments]]
**/
HelpFormatter.prototype.addArgument = function (action) {
- if (action.help !== $$.SUPPRESS) {
+ if (action.help !== c.SUPPRESS) {
var self = this;
// find all invocations
- var invocations = [this._formatActionInvocation(action)];
+ var invocations = [ this._formatActionInvocation(action) ];
var invocationLength = invocations[0].length;
var actionLength;
- if (!!action._getSubactions) {
+ if (action._getSubactions) {
this._indent();
action._getSubactions().forEach(function (subaction) {
@@ -255,7 +256,7 @@ HelpFormatter.prototype.addArgument = function (action) {
this._actionMaxLength = Math.max(this._actionMaxLength, actionLength);
// add the item to the list
- this._addItem(this._formatAction, [action]);
+ this._addItem(this._formatAction, [ action ]);
}
};
@@ -298,20 +299,20 @@ HelpFormatter.prototype.addArguments = function (actions) {
HelpFormatter.prototype.formatHelp = function () {
var help = this._rootSection.formatHelp(this);
if (help) {
- help = help.replace(this._longBreakMatcher, $$.EOL + $$.EOL);
- help = _.trim(help, $$.EOL) + $$.EOL;
+ help = help.replace(this._longBreakMatcher, c.EOL + c.EOL);
+ help = $$.trimChars(help, c.EOL) + c.EOL;
}
return help;
};
HelpFormatter.prototype._joinParts = function (partStrings) {
return partStrings.filter(function (part) {
- return (!!part && part !== $$.SUPPRESS);
+ return (part && part !== c.SUPPRESS);
}).join('');
};
HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix) {
- if (!prefix && !_.isString(prefix)) {
+ if (!prefix && typeof prefix !== 'string') {
prefix = 'usage: ';
}
@@ -321,7 +322,7 @@ HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix)
// if usage is specified, use that
if (usage) {
- usage = sprintf(usage, {prog: this._prog});
+ usage = sprintf(usage, { prog: this._prog });
// if no optionals or positionals are available, usage is just prog
} else if (!usage && actions.length === 0) {
@@ -346,7 +347,7 @@ HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix)
// build full usage string
actionUsage = this._formatActionsUsage([].concat(optionals, positionals), groups);
- usage = [prog, actionUsage].join(' ');
+ usage = [ prog, actionUsage ].join(' ');
// wrap the usage parts if it's too long
textWidth = this._width - this._currentIndent;
@@ -369,11 +370,12 @@ HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix)
}
// helper for wrapping lines
+ /*eslint-disable func-style*/ // node 0.10 compat
var _getLines = function (parts, indent, prefix) {
var lines = [];
var line = [];
- var lineLength = !!prefix ? prefix.length - 1: indent.length - 1;
+ var lineLength = prefix ? prefix.length - 1 : indent.length - 1;
parts.forEach(function (part) {
if (lineLength + 1 + part.length > textWidth) {
@@ -397,21 +399,21 @@ HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix)
var lines, indent, parts;
// if prog is short, follow it with optionals or positionals
if (prefix.length + prog.length <= 0.75 * textWidth) {
- indent = _.repeat(' ', (prefix.length + prog.length + 1));
+ indent = $$.repeat(' ', (prefix.length + prog.length + 1));
if (optionalParts) {
lines = [].concat(
- _getLines([prog].concat(optionalParts), indent, prefix),
+ _getLines([ prog ].concat(optionalParts), indent, prefix),
_getLines(positionalParts, indent)
);
} else if (positionalParts) {
- lines = _getLines([prog].concat(positionalParts), indent, prefix);
+ lines = _getLines([ prog ].concat(positionalParts), indent, prefix);
} else {
- lines = [prog];
+ lines = [ prog ];
}
// if prog is long, put it on its own line
} else {
- indent = _.repeat(' ', prefix.length);
+ indent = $$.repeat(' ', prefix.length);
parts = optionalParts + positionalParts;
lines = _getLines(parts, indent);
if (lines.length > 1) {
@@ -420,15 +422,15 @@ HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix)
_getLines(positionalParts, indent)
);
}
- lines = [prog] + lines;
+ lines = [ prog ] + lines;
}
// join lines into usage
- usage = lines.join($$.EOL);
+ usage = lines.join(c.EOL);
}
}
// prefix with 'usage:'
- return prefix + usage + $$.EOL + $$.EOL;
+ return prefix + usage + c.EOL + c.EOL;
};
HelpFormatter.prototype._formatActionsUsage = function (actions, groups) {
@@ -446,24 +448,22 @@ HelpFormatter.prototype._formatActionsUsage = function (actions, groups) {
end = start + group._groupActions.length;
//if (actions.slice(start, end) === group._groupActions) {
- if (_.isEqual(actions.slice(start, end), group._groupActions)) {
+ if ($$.arrayEqual(actions.slice(start, end), group._groupActions)) {
group._groupActions.forEach(function (action) {
groupActions.push(action);
});
if (!group.required) {
- if (!!inserts[start]) {
+ if (inserts[start]) {
inserts[start] += ' [';
- }
- else {
+ } else {
inserts[start] = '[';
}
inserts[end] = ']';
} else {
- if (!!inserts[start]) {
+ if (inserts[start]) {
inserts[start] += ' (';
- }
- else {
+ } else {
inserts[start] = '(';
}
inserts[end] = ')';
@@ -486,7 +486,7 @@ HelpFormatter.prototype._formatActionsUsage = function (actions, groups) {
// suppressed arguments are marked with None
// remove | separators for suppressed arguments
- if (action.help === $$.SUPPRESS) {
+ if (action.help === c.SUPPRESS) {
parts.push(null);
if (inserts[actionIndex] === '|') {
inserts.splice(actionIndex, actionIndex);
@@ -549,17 +549,17 @@ HelpFormatter.prototype._formatActionsUsage = function (actions, groups) {
text = text.replace(/\( *\)/g, '');
text = text.replace(/\(([^|]*)\)/g, '$1'); // remove () from single action groups
- text = _.trim(text);
+ text = text.trim();
// return the text
return text;
};
HelpFormatter.prototype._formatText = function (text) {
- text = sprintf(text, {prog: this._prog});
+ text = sprintf(text, { prog: this._prog });
var textWidth = this._width - this._currentIndent;
- var indentIncriment = _.repeat(' ', this._currentIndent);
- return this._fillText(text, textWidth, indentIncriment) + $$.EOL + $$.EOL;
+ var indentIncriment = $$.repeat(' ', this._currentIndent);
+ return this._fillText(text, textWidth, indentIncriment) + c.EOL + c.EOL;
};
HelpFormatter.prototype._formatAction = function (action) {
@@ -578,40 +578,40 @@ HelpFormatter.prototype._formatAction = function (action) {
// no help; start on same line and add a final newline
if (!action.help) {
- actionHeader = _.repeat(' ', this._currentIndent) + actionHeader + $$.EOL;
+ actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL;
// short action name; start on the same line and pad two spaces
} else if (actionHeader.length <= actionWidth) {
- actionHeader = _.repeat(' ', this._currentIndent) +
+ actionHeader = $$.repeat(' ', this._currentIndent) +
actionHeader +
' ' +
- _.repeat(' ', actionWidth - actionHeader.length);
+ $$.repeat(' ', actionWidth - actionHeader.length);
indentFirst = 0;
// long action name; start on the next line
} else {
- actionHeader = _.repeat(' ', this._currentIndent) + actionHeader + $$.EOL;
+ actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL;
indentFirst = helpPosition;
}
// collect the pieces of the action help
- parts = [actionHeader];
+ parts = [ actionHeader ];
// if there was help for the action, add lines of help text
- if (!!action.help) {
+ if (action.help) {
helpText = this._expandHelp(action);
helpLines = this._splitLines(helpText, helpWidth);
- parts.push(_.repeat(' ', indentFirst) + helpLines[0] + $$.EOL);
+ parts.push($$.repeat(' ', indentFirst) + helpLines[0] + c.EOL);
helpLines.slice(1).forEach(function (line) {
- parts.push(_.repeat(' ', helpPosition) + line + $$.EOL);
+ parts.push($$.repeat(' ', helpPosition) + line + c.EOL);
});
// or add a newline if the description doesn't end with one
- } else if (actionHeader.charAt(actionHeader.length - 1) !== $$.EOL) {
- parts.push($$.EOL);
+ } else if (actionHeader.charAt(actionHeader.length - 1) !== c.EOL) {
+ parts.push(c.EOL);
}
// if there are any sub-actions, add their help as well
- if (!!action._getSubactions) {
+ if (action._getSubactions) {
this._indent();
action._getSubactions().forEach(function (subaction) {
parts.push(self._formatAction(subaction));
@@ -627,43 +627,41 @@ HelpFormatter.prototype._formatActionInvocation = function (action) {
var format_func = this._metavarFormatter(action, action.dest);
var metavars = format_func(1);
return metavars[0];
- } else {
- var parts = [];
- var argsDefault;
- var argsString;
+ }
- // if the Optional doesn't take a value, format is: -s, --long
- if (action.nargs === 0) {
- parts = parts.concat(action.optionStrings);
+ var parts = [];
+ var argsDefault;
+ var argsString;
- // if the Optional takes a value, format is: -s ARGS, --long ARGS
- } else {
- argsDefault = action.dest.toUpperCase();
- argsString = this._formatArgs(action, argsDefault);
- action.optionStrings.forEach(function (optionString) {
- parts.push(optionString + ' ' + argsString);
- });
- }
- return parts.join(', ');
+ // if the Optional doesn't take a value, format is: -s, --long
+ if (action.nargs === 0) {
+ parts = parts.concat(action.optionStrings);
+
+ // if the Optional takes a value, format is: -s ARGS, --long ARGS
+ } else {
+ argsDefault = action.dest.toUpperCase();
+ argsString = this._formatArgs(action, argsDefault);
+ action.optionStrings.forEach(function (optionString) {
+ parts.push(optionString + ' ' + argsString);
+ });
}
+ return parts.join(', ');
};
HelpFormatter.prototype._metavarFormatter = function (action, metavarDefault) {
var result;
- if (!!action.metavar || action.metavar === '') {
+ if (action.metavar || action.metavar === '') {
result = action.metavar;
- } else if (!!action.choices) {
+ } else if (action.choices) {
var choices = action.choices;
- if (_.isString(choices)) {
+ if (typeof choices === 'string') {
choices = choices.split('').join(', ');
- } else if (_.isArray(choices)) {
+ } else if (Array.isArray(choices)) {
choices = choices.join(',');
- }
- else
- {
- choices = _.keys(choices).join(',');
+ } else {
+ choices = Object.keys(choices).join(',');
}
result = '{' + choices + '}';
} else {
@@ -673,13 +671,13 @@ HelpFormatter.prototype._metavarFormatter = function (action, metavarDefault) {
return function (size) {
if (Array.isArray(result)) {
return result;
- } else {
- var metavars = [];
- for (var i = 0; i < size; i += 1) {
- metavars.push(result);
- }
- return metavars;
}
+
+ var metavars = [];
+ for (var i = 0; i < size; i += 1) {
+ metavars.push(result);
+ }
+ return metavars;
};
};
@@ -690,27 +688,28 @@ HelpFormatter.prototype._formatArgs = function (action, metavarDefault) {
var buildMetavar = this._metavarFormatter(action, metavarDefault);
switch (action.nargs) {
+ /*eslint-disable no-undefined*/
case undefined:
case null:
metavars = buildMetavar(1);
result = '' + metavars[0];
break;
- case $$.OPTIONAL:
+ case c.OPTIONAL:
metavars = buildMetavar(1);
result = '[' + metavars[0] + ']';
break;
- case $$.ZERO_OR_MORE:
+ case c.ZERO_OR_MORE:
metavars = buildMetavar(2);
result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]';
break;
- case $$.ONE_OR_MORE:
+ case c.ONE_OR_MORE:
metavars = buildMetavar(2);
result = '' + metavars[0] + ' [' + metavars[1] + ' ...]';
break;
- case $$.REMAINDER:
+ case c.REMAINDER:
result = '...';
break;
- case $$.PARSER:
+ case c.PARSER:
metavars = buildMetavar(1);
result = metavars[0] + ' ...';
break;
@@ -727,20 +726,18 @@ HelpFormatter.prototype._expandHelp = function (action) {
Object.keys(action).forEach(function (actionProperty) {
var actionValue = action[actionProperty];
- if (actionValue !== $$.SUPPRESS) {
+ if (actionValue !== c.SUPPRESS) {
params[actionProperty] = actionValue;
}
});
- if (!!params.choices) {
- if (_.isString(params.choices)) {
+ if (params.choices) {
+ if (typeof params.choices === 'string') {
params.choices = params.choices.split('').join(', ');
- }
- else if (_.isArray(params.choices)) {
+ } else if (Array.isArray(params.choices)) {
params.choices = params.choices.join(', ');
- }
- else {
- params.choices = _.keys(params.choices).join(', ');
+ } else {
+ params.choices = Object.keys(params.choices).join(', ');
}
}
@@ -749,17 +746,17 @@ HelpFormatter.prototype._expandHelp = function (action) {
HelpFormatter.prototype._splitLines = function (text, width) {
var lines = [];
- var delimiters = [" ", ".", ",", "!", "?"];
+ var delimiters = [ ' ', '.', ',', '!', '?' ];
var re = new RegExp('[' + delimiters.join('') + '][^' + delimiters.join('') + ']*$');
text = text.replace(/[\n\|\t]/g, ' ');
- text = _.trim(text);
+ text = text.trim();
text = text.replace(this._whitespaceMatcher, ' ');
// Wraps the single paragraph in text (a string) so every line
// is at most width characters long.
- text.split($$.EOL).forEach(function (line) {
+ text.split(c.EOL).forEach(function (line) {
if (width >= line.length) {
lines.push(line);
return;
@@ -790,7 +787,7 @@ HelpFormatter.prototype._fillText = function (text, width, indent) {
lines = lines.map(function (line) {
return indent + line;
});
- return lines.join($$.EOL);
+ return lines.join(c.EOL);
};
HelpFormatter.prototype._getHelpString = function (action) {
diff --git a/tools/eslint/node_modules/argparse/lib/namespace.js b/tools/eslint/node_modules/argparse/lib/namespace.js
index 2f1f8f4daa..a860de9ecc 100644
--- a/tools/eslint/node_modules/argparse/lib/namespace.js
+++ b/tools/eslint/node_modules/argparse/lib/namespace.js
@@ -10,7 +10,7 @@
**/
'use strict';
-var _ = require('lodash');
+var $$ = require('./utils');
/**
* new Namespace(options)
@@ -18,7 +18,7 @@ var _ = require('lodash');
*
**/
var Namespace = module.exports = function Namespace(options) {
- _.extend(this, options);
+ $$.extend(this, options);
};
/**
@@ -28,7 +28,7 @@ var Namespace = module.exports = function Namespace(options) {
* Tells whenever `namespace` contains given `key` or not.
**/
Namespace.prototype.isset = function (key) {
- return _.has(this, key);
+ return $$.has(this, key);
};
/**
@@ -41,7 +41,7 @@ Namespace.prototype.isset = function (key) {
**/
Namespace.prototype.set = function (key, value) {
if (typeof (key) === 'object') {
- _.extend(this, key);
+ $$.extend(this, key);
} else {
this[key] = value;
}
@@ -56,7 +56,7 @@ Namespace.prototype.set = function (key, value) {
* Return the property key or defaulValue if not set
**/
Namespace.prototype.get = function (key, defaultValue) {
- return !this[key] ? defaultValue: this[key];
+ return !this[key] ? defaultValue : this[key];
};
/**
@@ -71,7 +71,6 @@ Namespace.prototype.unset = function (key, defaultValue) {
if (value !== null) {
delete this[key];
return value;
- } else {
- return defaultValue;
}
+ return defaultValue;
};
diff --git a/tools/eslint/node_modules/argparse/lib/utils.js b/tools/eslint/node_modules/argparse/lib/utils.js
new file mode 100644
index 0000000000..4a9cf3edb6
--- /dev/null
+++ b/tools/eslint/node_modules/argparse/lib/utils.js
@@ -0,0 +1,57 @@
+'use strict';
+
+exports.repeat = function (str, num) {
+ var result = '';
+ for (var i = 0; i < num; i++) { result += str; }
+ return result;
+};
+
+exports.arrayEqual = function (a, b) {
+ if (a.length !== b.length) { return false; }
+ for (var i = 0; i < a.length; i++) {
+ if (a[i] !== b[i]) { return false; }
+ }
+ return true;
+};
+
+exports.trimChars = function (str, chars) {
+ var start = 0;
+ var end = str.length - 1;
+ while (chars.indexOf(str.charAt(start)) >= 0) { start++; }
+ while (chars.indexOf(str.charAt(end)) >= 0) { end--; }
+ return str.slice(start, end + 1);
+};
+
+exports.capitalize = function (str) {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+};
+
+exports.arrayUnion = function () {
+ var result = [];
+ for (var i = 0, values = {}; i < arguments.length; i++) {
+ var arr = arguments[i];
+ for (var j = 0; j < arr.length; j++) {
+ if (!values[arr[j]]) {
+ values[arr[j]] = true;
+ result.push(arr[j]);
+ }
+ }
+ }
+ return result;
+};
+
+function has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+}
+
+exports.has = has;
+
+exports.extend = function (dest, src) {
+ for (var i in src) {
+ if (has(src, i)) { dest[i] = src[i]; }
+ }
+};
+
+exports.trimEnd = function (str) {
+ return str.replace(/\s+$/g, '');
+};
diff --git a/tools/eslint/node_modules/argparse/package.json b/tools/eslint/node_modules/argparse/package.json
index 2ad636b89c..8d3efc9619 100644
--- a/tools/eslint/node_modules/argparse/package.json
+++ b/tools/eslint/node_modules/argparse/package.json
@@ -2,20 +2,24 @@
"_args": [
[
"argparse@^1.0.2",
- "/Users/mzasso/git/forks/node/node_modules/eslint/node_modules/js-yaml"
+ "/Users/trott/test/node_modules/eslint/node_modules/js-yaml"
]
],
"_from": "argparse@>=1.0.2 <2.0.0",
- "_id": "argparse@1.0.3",
+ "_id": "argparse@1.0.6",
"_inCache": true,
"_installable": true,
"_location": "/eslint/argparse",
- "_nodeVersion": "4.2.1",
+ "_nodeVersion": "4.2.6",
+ "_npmOperationalInternal": {
+ "host": "packages-6-west.internal.npmjs.com",
+ "tmp": "tmp/argparse-1.0.6.tgz_1454752276282_0.7111219766084105"
+ },
"_npmUser": {
"email": "vitaly@rcdesign.ru",
"name": "vitaly"
},
- "_npmVersion": "2.14.7",
+ "_npmVersion": "2.14.12",
"_phantomChildren": {},
"_requested": {
"name": "argparse",
@@ -28,11 +32,11 @@
"_requiredBy": [
"/eslint/js-yaml"
],
- "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.3.tgz",
- "_shasum": "14389deeb0c28fc4cda9405b9f532a4e3785ce84",
+ "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.6.tgz",
+ "_shasum": "ada3c46ade64695906efbb7a0a337f619abb4694",
"_shrinkwrap": null,
"_spec": "argparse@^1.0.2",
- "_where": "/Users/mzasso/git/forks/node/node_modules/eslint/node_modules/js-yaml",
+ "_where": "/Users/trott/test/node_modules/eslint/node_modules/js-yaml",
"bugs": {
"url": "https://github.com/nodeca/argparse/issues"
},
@@ -45,32 +49,38 @@
}
],
"dependencies": {
- "lodash": ">= 3.2.0 < 4.0.0",
"sprintf-js": "~1.0.2"
},
"description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library",
"devDependencies": {
- "mocha": "*"
+ "eslint": "2.0.0-rc.0",
+ "eslint-plugin-nodeca": "~1.0.3",
+ "mocha": "*",
+ "ndoc": "^3.1.0"
},
"directories": {},
"dist": {
- "shasum": "14389deeb0c28fc4cda9405b9f532a4e3785ce84",
- "tarball": "http://registry.npmjs.org/argparse/-/argparse-1.0.3.tgz"
+ "shasum": "ada3c46ade64695906efbb7a0a337f619abb4694",
+ "tarball": "http://registry.npmjs.org/argparse/-/argparse-1.0.6.tgz"
},
- "gitHead": "e46e471f113ba31074c0d0c156f93fd7a618b27c",
+ "files": [
+ "index.js",
+ "lib/"
+ ],
+ "gitHead": "f8810fdae9ab4eb68283ba4c5f62baeaf0c0719d",
"homepage": "https://github.com/nodeca/argparse",
"keywords": [
- "argparse",
- "args",
"cli",
+ "parser",
+ "argparse",
"option",
- "parser"
+ "args"
],
"license": "MIT",
"maintainers": [
{
- "name": "vitaly",
- "email": "vitaly@rcdesign.ru"
+ "email": "vitaly@rcdesign.ru",
+ "name": "vitaly"
}
],
"name": "argparse",
@@ -83,5 +93,5 @@
"scripts": {
"test": "make test"
},
- "version": "1.0.3"
+ "version": "1.0.6"
}