cmdex (command executor)
a simple framework for executing commands
Usage
import { execute, cmd } from "cmdex";
const incrementHandler = {
handler: num => cmd('incremented', num + 1);
}
const executor = execute({ handlers: { increment: incrementHandler }})
const myCommand = cmd('increment', 1); // Command
const responses = executor(myCommand); // Response: [{ action: 'incremented', 2 }];
const myIncrementedNumber = pluckAction('incremented')(responses); // 2