packages/warriorjs-geography/src/rotateRelativeOffset.js
function rotateRelativeOffset([forward, right], direction) {
  verifyRelativeDirection(direction);

  if (direction === FORWARD) {
    return [forward, right];
  }

  if (direction === RIGHT) {
    return [-right, forward];
  }

  if (direction === BACKWARD) {
    return [-forward, -right];
  }

  return [right, -forward];
}
function rotateRelativeOffset([forward, right], direction) {
  verifyRelativeDirection(direction);

  if (direction === FORWARD) {
    return [forward, right];
  }

  if (direction === RIGHT) {
    return [-right, forward];
  }

  if (direction === BACKWARD) {
    return [-forward, -right];
  }

  return [right, -forward];
}
function rotateRelativeOffset ( [ forward , right ] , direction ) { verifyRelativeDirection ( direction ) ; if ( direction === FORWARD ) { return [ forward , right ] ; } if ( direction === RIGHT ) { return [ - right , forward ] ; } if ( direction === BACKWARD ) { return [ - forward , - right ] ; } return [ right , - forward ] ; }
Rotates the given relative offset in the given direction.

@param {number[]} offset The relative offset as [forward, right].
@param {string} direction The direction (relative direction).

@returns {number[]} The rotated offset as [forward, right].
Rotates the given relative offset in the given direction .