function compile(filename, ready) { return fs.readFile(filename, make_fn) function make_fn(err, data) { if(err) return ready(err) ready(null, new Function(data)) } }
Also, whenever possible, I like to nix callbacks by using Function#bind:
res.on('data', accum.push.bind(accum)) // vs: res.on('data', function(data) { accum.push(data) })
Array.prototype.push.bind(accum) [].push.bind(accum)
There's one (and only one) non-DOM jquery method I enjoy for that sort of things, because it avoids repetition: $.proxy(Object, String)
accum.push.bind(accum)
$.proxy(accum, 'push')
Of course, things would still be better if javascript just bound method on instance prototype lookup.
Also, whenever possible, I like to nix callbacks by using Function#bind: