Data processor in TypeScript
yarn add @sudoo/processor
# Or
npm install @sudoo/processor --save
Process can be load by SideEffect
, Processor
and Verifier
functions.
import { AsyncDataHook } from "@sudoo/processor";
const processor: AsyncDataHook = AsyncDataHook.create();
processor.sideEffect.add(() => sendEmail());
processor.processor.add((data) => newData);
processor.verifier.add((data) => true);
processor.execute(data)
, you can execute all side effects.newData = processor.process(data)
, you can process data pipelined.result = processor.verify(data)
, you can verify data if is valid.