https://github.com/wmfs/asl-choice-processor
For determining the next state given an Amazon States Language "Choices" definition and a set of values.
https://github.com/wmfs/asl-choice-processor
amazon-states-language package tymly
Last synced: 16 days ago
JSON representation
For determining the next state given an Amazon States Language "Choices" definition and a set of values.
- Host: GitHub
- URL: https://github.com/wmfs/asl-choice-processor
- Owner: wmfs
- License: mit
- Created: 2018-06-11T09:07:56.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-05-02T00:37:25.000Z (28 days ago)
- Last Synced: 2025-05-02T01:27:34.099Z (28 days ago)
- Topics: amazon-states-language, package, tymly
- Language: JavaScript
- Homepage:
- Size: 309 KB
- Stars: 4
- Watchers: 6
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# asl-choice-processor
[](https://tymly.io/) [](https://www.npmjs.com/package/@wmfs/asl-choice-processor) [](https://circleci.com/gh/wmfs/asl-choice-processor) [](https://codecov.io/gh/wmfs/asl-choice-processor) [](https://www.codefactor.io/repository/github/wmfs/asl-choice-processor) [](https://dependabot.com/) [](http://commitizen.github.io/cz-cli/) [](https://standardjs.com) [](https://github.com/wmfs/tymly/blob/master/packages/pg-concat/LICENSE)
> 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)](https://states-language.net/spec.html#choice-state)
* [Choice](http://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html#amazon-states-language-choice-state-rules) state documentation## Install
```bash
$ npm install asl-choice-processor --save
```## Usage
```javascript
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
```bash
$ npm test
```## License
[MIT](https://github.com/wmfs/tymly/packages/asl-choice-processor/blob/master/LICENSE)