src/index.js
/**
   * Determines the next key to be set in state by keyboard interaction.
   *
   * @param {String} keypress - A keyboard key representation as a string.
   * @returns {String} - The next key to set in state.
   */
Determines the next key to be set in state by keyboard interaction.
@param {String} keypress - A keyboard key representation as a string.
@returns {String} - The next key to set in state.
Determines the next key to be set in state by keyboard interaction . @param { String } keypress - A keyboard key representation as a string . @returns { String } - The next key to set in state .
function nextKey(keypress) {
    if (keypress.length === 1 && /\w/.test(keypress)) return onInput(keypress);
    if (JUMPS.includes(keypress)) return keys.at(JUMPS.indexOf(keypress) - 1);
    if (!arrows[orientation].includes(keypress)) return state.key;
    const index = keys.indexOf(state.key) + getDirection(keypress);
    if (loop) return keys.at(index) ? keys.at(index) : keys.at(0);
    return keys[index] ? keys[index] : state.key;
  }
function nextKey ( keypress ) { if ( keypress . length === 1 && / \w / . test ( keypress ) ) return onInput ( keypress ) ; if ( JUMPS . includes ( keypress ) ) return keys . at ( JUMPS . indexOf ( keypress ) - 1 ) ; if ( ! arrows [ orientation ] . includes ( keypress ) ) return state . key ; const index = keys . indexOf ( state . key ) + getDirection ( keypress ) ; if ( loop ) return keys . at ( index ) ? keys . at ( index ) : keys . at ( 0 ) ; return keys [ index ] ? keys [ index ] : state . key ; }
Determines the next key to be set in state by keyboard interaction.
Determines the next key to be set in state by keyboard interaction .