This pattern (IIFE, containing only a conditional, optionally with an else clause, where each branch of the conditional returns some value) should be transformed into something like foo ? bar : baz, assuming that the containing expression can take a ternary (return, assignment, etc should all be fine to accept a ternary in place of this expression).
From CoffeeScript, we get many of these gross IIFEs that are basically just ternary expressions:
This pattern (IIFE, containing only a conditional, optionally with an
else
clause, where each branch of the conditional returns some value) should be transformed into something likefoo ? bar : baz
, assuming that the containing expression can take a ternary (return
, assignment, etc should all be fine to accept a ternary in place of this expression).