Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function getPositionDifferences(options = {}) {
const { targetPosition, tooltipPosition } = getTooltipAndTargetPosition(options);
const { side } = options;
const distanceToTarget = targetPosition[side];
const distanceToTooltip = tooltipPosition[getOppositeSide(side)];
const shouldTooltipBeCloserThanTarget = side === 'top' || side === 'left';
const expectedGreaterDistance = shouldTooltipBeCloserThanTarget ? distanceToTarget : distanceToTooltip;
const expectedLesserDistance = shouldTooltipBeCloserThanTarget ? distanceToTooltip : distanceToTarget;
return { expectedGreaterDistance, expectedLesserDistance };
}