Created
August 18, 2016 09:36
-
-
Save rotemtam/89c141552d46ab7bb885980c7ca8a009 to your computer and use it in GitHub Desktop.
some-lambda-function
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
'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