Skip to content

Instantly share code, notes, and snippets.

@rotemtam
Created August 18, 2016 09:36
Show Gist options
  • Save rotemtam/89c141552d46ab7bb885980c7ca8a009 to your computer and use it in GitHub Desktop.
Save rotemtam/89c141552d46ab7bb885980c7ca8a009 to your computer and use it in GitHub Desktop.
some-lambda-function
'use strict';
module.exports = function doSomething(e, ctx, cb) {
if (e.someParam > 0) {
ctx.succeed('Yay');
// we add the callback here to make it testable
// we'll show in the next step how we make this DRY
if (cb) cb();
} else {
ctx.fail('Nay')
if(cb) cb('Error');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment