asl-choice-processor
For determining the next state given an Amazon States Language "Choices" definition and a set of values.
Useful links
Install
$ npm install asl-choice-processor --save
Usage
const choiceProcessor = require('asl-choice-processor')
const calculateNextState = choiceProcessor(
{
Choices: [
{
Variable: '$.foo',
NumericEquals: 1,
Next: 'FirstMatchState'
},
{
Variable: '$.foo',
NumericEquals: 2,
Next: 'SecondMatchState'
}
],
Default: 'DefaultMatchState'
}
)
calculateNextState( {foo: 1} )
calculateNextState( {foo: 2} )
calculateNextState( {foo: 3} )
Tests
$ npm test
License
MIT