0.0.5 • Published 6 years ago

asl-choice-processor v0.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

asl-choice-processor

JavaScript Style Guide license

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} ) // FirstMatchState
calculateNextState( {foo: 2} ) // SecondMatchState
calculateNextState( {foo: 3} ) // DefaultMatchState

Tests

$ npm test

License

MIT

0.0.5

6 years ago

0.0.4

7 years ago

0.0.2

7 years ago