Someone else needs to run parts of your code in a controlled fashion. Alternately, your language of choice cannot express the problem domain in a concise fashion.
Use the Interpreter pattern to create a domain-specific language that you translate into specific code.
Assume, for example, that the user wants to perform math inside of your application. You could let them forward code to eval but that would let them run arbitrary code. Instead, you can provide a miniature "stack calculator" language that you parse separately in order to only run mathematical operations while reporting more useful error messages.
As an alternative to writing our own interpreter, you can co-op the existing CoffeeScript interpreter in a such a way that its normal syntax makes for more natural (and therefore more comprehensible) expressions of your algorithm.
This example allows for layers of functions by how it returns the modified object so that outer functions can modify it in turn. By borrowing a verb and the preposition to, the example lends natural grammar to the construction and ends up reading like an actual sentence when used correctly. This way, both your CoffeeScript skills and your existing language skills can help catch code problems.