getOppositePlacement.js 382 B

1234567891011
  1. /**
  2. * Get the opposite placement of the given one
  3. * @method
  4. * @memberof Popper.Utils
  5. * @argument {String} placement
  6. * @returns {String} flipped placement
  7. */
  8. export default function getOppositePlacement(placement) {
  9. const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  10. return placement.replace(/left|right|bottom|top/g, matched => hash[matched]);
  11. }