Cleanup code for new getConditionalValue() support

This commit is contained in:
Bryan Ashby 2018-06-13 20:59:43 -06:00
parent ceab8a0180
commit 1870db7d38
1 changed files with 7 additions and 12 deletions

View File

@ -53,17 +53,12 @@ module.exports = class MenuStack {
assert(currentModuleInfo, 'Empty menu stack!'); assert(currentModuleInfo, 'Empty menu stack!');
const menuConfig = currentModuleInfo.instance.menuConfig; const menuConfig = currentModuleInfo.instance.menuConfig;
let nextMenu; const nextMenu = this.client.acs.getConditionalValue(menuConfig.next, 'next');
if(_.isArray(menuConfig.next)) {
nextMenu = this.client.acs.getConditionalValue(menuConfig.next, 'next');
if(!nextMenu) { if(!nextMenu) {
return cb(Errors.MenuStack('No matching condition for "next"', 'NOCONDMATCH')); return cb(Array.isArray(menuConfig.next) ?
} Errors.MenuStack('No matching condition for "next"', 'NOCONDMATCH') :
} else if(_.isString(menuConfig.next)) { Errors.MenuStack('Invalid or missing "next" member in menu config', 'BADNEXT')
nextMenu = menuConfig.next; );
} else {
return cb(Errors.MenuStack('Invalid or missing "next" member in menu config', 'BADNEXT'));
} }
if(nextMenu === currentModuleInfo.name) { if(nextMenu === currentModuleInfo.name) {