@wmfs/asl-choice-processor
v1.24.1
Published
For determining the next state given an Amazon States Language 'Choices' definition and a set of values.
Downloads
11,340
Maintainers
Readme
asl-choice-processor
For determining the next state given an Amazon States Language "Choices" definition and a set of values.
Useful links
- Amazon States Language specification (Apache License, Version 2.0)
- Choice state documentation
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} ) // FirstMatchState
calculateNextState( {foo: 2} ) // SecondMatchState
calculateNextState( {foo: 3} ) // DefaultMatchState
Tests
$ npm test