'use strict';var navigateList = {
  methods: {
    navigate: function navigate(list, isArrowDown, currentIndex) {
      var loop = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
      // depending if arrow was up or down set +/- one to add or subtract
      // generically
      var numberToAdd = isArrowDown ? 1 : -1;

      if (this.isWithinArrayLimit(list, isArrowDown, currentIndex + numberToAdd)) {
        // set new active entry
        return list[currentIndex + numberToAdd];
      }

      if (loop) {
        return list[isArrowDown ? 0 : list.length - 1];
      }

      return list[currentIndex];
    },
    isWithinArrayLimit: function isWithinArrayLimit(list, isArrowDown, newIndex) {
      // set variable for limit to check against
      // 0 for arrow up and array length for arrow down
      var listLimit = isArrowDown ? list.length : 0; // define operator functions to be able to use condition generically

      var operators = {
        '>=': function _(a, b) {
          return a >= b;
        },
        '<': function _(a, b) {
          return a < b;
        }
      }; // set the actual operator

      var operator = isArrowDown ? '<' : '>='; // return Boolean if it is within limits of array or not

      return operators[operator](newIndex, listLimit);
    }
  }
};exports.n=navigateList;