MCPcopy Create free account
hub / github.com/CodeForBreakfast/eventsourcing / handleConditional

Function handleConditional

examples/todo-app/src/cli.ts:63–67  ·  view source on GitHub ↗
(
  events: Readonly<ReadonlyArray<unknown>>,
  whenTrue: Readonly<Effect.Effect<void, E, R>>,
  whenFalse: Readonly<Effect.Effect<void, E, R>>
)

Source from the content-addressed store, hash-verified

61 );
62
63const handleConditional = <E, R>(
64 events: Readonly<ReadonlyArray<unknown>>,
65 whenTrue: Readonly<Effect.Effect<void, E, R>>,
66 whenFalse: Readonly<Effect.Effect<void, E, R>>
67): Effect.Effect<void, E, R> => (events.length > 0 ? whenTrue : whenFalse);
68
69const commitAndReturnId =
70 (todoId: TodoId, eventNumber: number, title: string) =>

Callers 2

processCommandFunction · 0.70
processListProjectionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected