Created
June 23, 2016 01:29
-
-
Save tjanczuk/76fceea16dd989ff29607a1fc35a60e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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