UNPKG

decision

Version:

Decision System Based on Event System and Alleyway Grammer

35 lines (32 loc) 709 B
import chainstyle from "chainstyle"; // TODO filter let Decision = chainstyle({ when: { checkType: ["string"] }, then: { checkType: ["string | function"] }, filter: { checkType: ["string | function"] }, data: { checkType: ["function"] }, named: { checkType: ["string"] } }, {}, { chainRegular: /^when\.(filter\.)?(data\.)?then(\.named)?$/ }); export default (marmoset, alleyway) => { let decisions = []; return { createFactory: () => () => { let decision = new Decision; decisions.push(decision); return decision; }, getDecisions: () => decisions } }