Files
TournamentTracker/MVCUI/Scripts/src/utils/getOppositePlacement.js
2020-04-22 23:34:46 +02:00

12 lines
382 B
JavaScript

/**
* Get the opposite placement of the given one
* @method
* @memberof Popper.Utils
* @argument {String} placement
* @returns {String} flipped placement
*/
export default function getOppositePlacement(placement) {
const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
return placement.replace(/left|right|bottom|top/g, matched => hash[matched]);
}