From a591f870f552e8cffa7bbb00d8345b2c969251bb Mon Sep 17 00:00:00 2001 From: Tomoaki Abe Date: Fri, 11 Oct 2019 12:59:32 +0900 Subject: [PATCH] Support Node.js 0.10 (Revert #1059) (#1074) fix #1073 --- CHANGELOG.md | 5 +++++ index.js | 6 +++--- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbfd20d06..5a60383f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +2.20.2 / 2019-10-11 +================== + + * Support Node.js 0.10 (Revert #1059) + 2.20.1 / 2019-09-29 ================== diff --git a/index.js b/index.js index aa8fdbd4d..ec1d61d58 100644 --- a/index.js +++ b/index.js @@ -99,7 +99,7 @@ Option.prototype.is = function(arg) { function Command(name) { this.commands = []; this.options = []; - this._execs = new Set(); + this._execs = {}; this._allowUnknownOption = false; this._args = []; this._name = name || ''; @@ -178,7 +178,7 @@ Command.prototype.command = function(name, desc, opts) { if (desc) { cmd.description(desc); this.executables = true; - this._execs.add(cmd._name); + this._execs[cmd._name] = true; if (opts.isDefault) this.defaultExecutable = cmd._name; } cmd._noHelp = !!opts.noHelp; @@ -484,7 +484,7 @@ Command.prototype.parse = function(argv) { })[0]; } - if (this._execs.has(name)) { + if (this._execs[name] === true) { return this.executeSubCommand(argv, args, parsed.unknown); } else if (aliasCommand) { // is alias of a subCommand diff --git a/package-lock.json b/package-lock.json index 27680f753..e4de9f7eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "commander", - "version": "2.20.1", + "version": "2.20.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2030,7 +2030,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } diff --git a/package.json b/package.json index 5e977fef1..096f894ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "commander", - "version": "2.20.1", + "version": "2.20.2", "description": "the complete solution for node.js command-line programs", "keywords": [ "commander",