Skip to content

Commit 07fba61

Browse files
authored
Merge pull request #24 from vkkis93/fix/deepLevelChoice
Fix/deep level choice
2 parents 9936d0a + 42e2ec1 commit 07fba61

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

build.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,7 @@ module.exports = {
188188

189189
_passStateFields(currentState, event) {
190190
if (!currentState.ResultPath) {
191-
if (!currentState.Result) {
192-
return event;
193-
}
194-
return currentState.Result;
191+
return currentState.Result || event;
195192
} else {
196193
const variableName = currentState.ResultPath.split('$.')[1];
197194
if (!currentState.Result) {
@@ -209,9 +206,10 @@ module.exports = {
209206
//look through choice and find appropriate
210207
_.forEach(data.choice, choice => {
211208
//check if result from previous function has of value which described in Choice
212-
if (!_.isNil(result[choice.variable])) {
209+
const functionResultValue = _.get(result, choice.variable);
210+
if (!_.isNil(functionResultValue)) {
213211
//check condition
214-
const isConditionTrue = choice.checkFunction(result[choice.variable], choice.compareWithValue);
212+
const isConditionTrue = choice.checkFunction(functionResultValue, choice.compareWithValue);
215213
if (isConditionTrue) {
216214
existsAnyMatches = true;
217215
return this.process(this.states[choice.choiceFunction], choice.choiceFunction, result);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "serverless-step-functions-offline",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"description": "Serverlesss plugin to support step function offline",
55
"main": "index.js",
66
"author": "viktor.kis <[email protected]>",

0 commit comments

Comments
 (0)