all files / popper/utils/ getOppositePlacement.js

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 2/2
1 2 3 4 5 6 7 8 9 10 11 12                296× 296×    
/**
 * 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]);
}