Skip to content

Commit

Permalink
Merge pull request #24 from vkkis93/fix/deepLevelChoice
Browse files Browse the repository at this point in the history
Fix/deep level choice
  • Loading branch information
vkkis93 authored Nov 28, 2018
2 parents 9936d0a + 42e2ec1 commit 07fba61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,7 @@ module.exports = {

_passStateFields(currentState, event) {
if (!currentState.ResultPath) {
if (!currentState.Result) {
return event;
}
return currentState.Result;
return currentState.Result || event;
} else {
const variableName = currentState.ResultPath.split('$.')[1];
if (!currentState.Result) {
Expand All @@ -209,9 +206,10 @@ module.exports = {
//look through choice and find appropriate
_.forEach(data.choice, choice => {
//check if result from previous function has of value which described in Choice
if (!_.isNil(result[choice.variable])) {
const functionResultValue = _.get(result, choice.variable);
if (!_.isNil(functionResultValue)) {
//check condition
const isConditionTrue = choice.checkFunction(result[choice.variable], choice.compareWithValue);
const isConditionTrue = choice.checkFunction(functionResultValue, choice.compareWithValue);
if (isConditionTrue) {
existsAnyMatches = true;
return this.process(this.states[choice.choiceFunction], choice.choiceFunction, result);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "serverless-step-functions-offline",
"version": "2.1.1",
"version": "2.1.2",
"description": "Serverlesss plugin to support step function offline",
"main": "index.js",
"author": "viktor.kis <[email protected]>",
Expand Down

0 comments on commit 07fba61

Please sign in to comment.