You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
312 B

  1. // @flow
  2. import type { Placement } from '../enums';
  3. const hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  4. export default function getOppositePlacement(placement: Placement): Placement {
  5. return (placement.replace(
  6. /left|right|bottom|top/g,
  7. matched => hash[matched]
  8. ): any);
  9. }