UNPKG

@coorpacademy/progression-engine

Version:

24 lines (20 loc) 803 B
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; import updateVariables from '../rule-engine/apply-instructions'; const variables = config => (_state, action) => { const state = _state.variables ? _state : _extends({}, _state, { variables: {} }); switch (action.type) { case 'answer': case 'move': { const { instructions } = action.payload; if (!instructions) return state; return updateVariables(instructions)(state); } default: { return state; } } }; export default variables; //# sourceMappingURL=variables.js.map