UNPKG

@wmfs/asl-choice-processor

Version:

For determining the next state given an Amazon States Language 'Choices' definition and a set of values.

28 lines (23 loc) 441 B
const operators = require('./operators') module.exports = function findOperator (choice) { let fn let value let isPath = false Object.entries(choice).forEach(([k, v]) => { if (fn === undefined) { if (k.endsWith('Path')) { k = k.split('Path')[0] isPath = true } if (operators[k]) { fn = operators[k] value = v } } }) return { fn, value, isPath } }