Skip to content

Commit

Permalink
Use a default value to mark optdef as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Alhadis committed Oct 10, 2018
1 parent 33944e9 commit e99e504
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,17 @@ function autoOpts(input, config = {}){
* Extract command-line options from a list of strings.
*
* @param {Array} input
* @param {String|Object} optdef
* @param {String|Object} [optdef=null]
* @param {Object} [config={}]
*/
function getOpts(input, optdef, config = {}){
function getOpts(input, optdef = null, config = {}){

// Do nothing if given nothing
if(!input || 0 === input.length)
return {options: {}, argv: []};

// Take a different approach if optdefs aren't specified
if(null == optdef || "" === optdef || false === optdef)
if(null === optdef || "" === optdef || false === optdef)
return autoOpts(input, config);


Expand Down

0 comments on commit e99e504

Please sign in to comment.