1 function incrementListIndex(current, dir, opt) {
2 var len = opt.choices.realLength;
3 var shouldLoop = 'loop' in opt ? Boolean(opt.loop) : true;
8 return shouldLoop ? len - 1 : current;
11 if (current < len - 1) {
14 return shouldLoop ? 0 : current;
16 throw new Error('dir must be up or down');
19 module.exports = incrementListIndex;