Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/N4m/command-line-args int…
Browse files Browse the repository at this point in the history
…o next
  • Loading branch information
75lb committed Jul 30, 2016
2 parents 2a8b866 + 25d1eb2 commit 7913ed3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
12 changes: 10 additions & 2 deletions es5/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,19 @@ var OptionDefinition = function () {
}, {
key: 'isBoolean',
value: function isBoolean() {
return this.type === Boolean;
if (!this.type) {
return false;
} else { // Fall back to ES5 Method
var result = /^function\s+([\w\$]+)\s*\(/.exec( this.type.toString() );
if (result && result.length>=2 && result[1] == "Boolean") {
return true;
}
}
return false;
}
}]);

return OptionDefinition;
}();

module.exports = OptionDefinition;
module.exports = OptionDefinition;
12 changes: 11 additions & 1 deletion lib/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,17 @@ class OptionDefinition {
}

isBoolean () {
return this.type === Boolean
if (!this.type) {
return false;
} else if (this.type.name == "Boolean") { // First try ES6 Method
return true;
} else { // Fall back to ES5 Method
var result = /^function\s+([\w\$]+)\s*\(/.exec( this.type.toString() );
if (result && result.length>=2 && result[1] == "Boolean") {
return true;
}
}
return false;
}
}

Expand Down

0 comments on commit 7913ed3

Please sign in to comment.