Skip to content

Instantly share code, notes, and snippets.

@ox
Created June 11, 2013 20:52
Show Gist options
  • Save ox/5760558 to your computer and use it in GitHub Desktop.
Save ox/5760558 to your computer and use it in GitHub Desktop.
Compiler-safe invertPosition
invertPosition = function (position) {
return ((position === 'top' || position === 'bottom') ? (position === 'top' ? 'bottom' : 'top') : ((position === 'left' || position === 'right') ? (position === 'left' ? 'right' : 'left') : null))
}
@jdan
Copy link

jdan commented Jun 11, 2013

👊

@thebyrd
Copy link

thebyrd commented Jun 11, 2013

that's so much worse than :

obv.ui.Tooltip.prototype._invertPosition = function (position) {
 return {top: 'bottom', bottom: 'top', left: 'right', right: 'left'}[position]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment