Skip to content

Instantly share code, notes, and snippets.

@rightfold
Created January 13, 2015 19:54
Show Gist options
  • Save rightfold/ffbdb00cedd6557a29f7 to your computer and use it in GitHub Desktop.
Save rightfold/ffbdb00cedd6557a29f7 to your computer and use it in GitHub Desktop.
function compileExpr(expr) {
try {
return compileExprToESExpr(expr);
} catch (e) {
if (e instanceof MustCompileToESStmtError) {
const stmts = compileExprToESStmts(expr, true);
return wrapInIIFE(stmts);
} else {
throw e;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment