From 394c7a0fdd4d375bd49c01d5fad23c68e992027c Mon Sep 17 00:00:00 2001 From: Alhadis Date: Wed, 27 Feb 2019 16:35:10 +1100 Subject: [PATCH] Alleviate weird issue with duplicate handling This is still a bug, albeit one less glaring than before. This module is in dire need of a full rewrite... --- index.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index ca75cb4..9abf469 100644 --- a/index.js +++ b/index.js @@ -524,18 +524,17 @@ function getOpts(input, optdef = null, config = {}){ else{ const {names} = option; - // Ascertain if this option's being duplicated - if(result.options[ names[0] ]) - value = resolveDuplicate(option, value); - - - option.names.forEach(name => { + for(let name of names){ // Decide whether to camelCase this option name name = formatName(name, noCamelCase); + // Ascertain if this option's being duplicated + if(result.options[name]) + resolveDuplicate(option, name, value); + result.options[name] = value; - }); + } } }