/** * Generate a string out of the choices keys * @param {Array} choices * @param {Number|String} default - the choice index or name to capitalize * @return {String} The rendered choices key string */ generateChoicesString(choices, defaultChoice) { var defIndex = choices.realLength - 1; if (_$c.isNumber(defaultChoice) && this.opt.choices.getChoice(defaultChoice)) { defIndex = defaultChoice; } else if (_$c.isString(defaultChoice)) { let index = _$c.findIndex( choices.realChoices, ({ value }) => value === defaultChoice ); defIndex = index === -1 ? defIndex : index; } var defStr = this.opt.choices.pluck('key'); this.rawDefault = defStr[defIndex]; defStr[defIndex] = String(defStr[defIndex]).toUpperCase(); return defStr.join(''); }