Skip to content

Instantly share code, notes, and snippets.

@tjanczuk
Created June 23, 2016 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjanczuk/76fceea16dd989ff29607a1fc35a60e2 to your computer and use it in GitHub Desktop.
Save tjanczuk/76fceea16dd989ff29607a1fc35a60e2 to your computer and use it in GitHub Desktop.
module.exports = function (options, cb) {
options.nodejsCompiler('return ' + options.script, function (error, func) {
if (error) return cb(error);
return cb(null, function (ctx, cb) {
func(ctx.body.user, ctx.body.context, function (error, user, context) {
cb(error, error ? null : { user: user, context: context });
});
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment