evt.pipe(...)
An alternative to compose for chaining operaors.
Return
Parameters
Examples
import { Evt } from "evt";
type Circle = { type: "CIRCLE"; radius: number; };
type Square = { type: "SQUARE"; sideLength: number; };
type Shape = Circle | Square;
const evtShape = new Evt<Shape | undefined>();
evtShape.pipe(
shape => !shape ? null : [ shape ], // Filter out undefined
shape => shape.type !== "CIRCLE" ? null : [ shape ], // Filter Circle
({ radius }) => [ radius ], // Extract radius
radius => radius > 200 ? "DETACH": [ radius ] //Detach if radius too large
).attach(radius=> { /* ... */ });Creating delegates
Last updated