I agree, one solution is to support an optional argument to replace.
Whatever the solution, it's probably important to expose this functionality
since any `function` body replacement will require the same technique so
long as it has a `return` expression.  Similarly, loop blocks will probably
need a wrapper if they `break` or `continue`. Etc.
On May 7, 2014 9:07 AM, "Giovanni Fernandez-Kincade" <
notifications@github.com> wrote:

> In src/index.js:
>
> > @@ -317,9 +317,39 @@ StatementTrait = _.extend({}, {
> >       }
> >  });
> >
> > +BlockContainerTrait = _.extend({}, {
> > +    parseAndExtractCorrespondingNode: function(code) {
> > +        var node = astronaut(esprima.parse(code));
> > +        return node.body()[0].data.body;
>
> Ahh right. I guess the one bummer is that this is used by replace, which
> is publicly accessible and available for block containers. But it will only
> ever work if the caller does the same function wrapping business, which is
> ackward/strange. That's probably fine for now - don't want to block you.
> Trying to think of a cleaner solution...
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/giokincade/astronaut/pull/1/files#r12374919>
> .
>