@yantrix/automata v0.6.0 • Docs
Yantrix API / @yantrix/automata / createModelPredicate
Function: createModelPredicate() ​
ts
function createModelPredicate<ModelType, Select, EventType, EventMetaType>(select, predicate): TModelPredicate<ModelType, EventType, EventMetaType>Lifts a Predicate over one selected value into a Model Predicate.
Keeping selection separate makes the Data Model dependency explicit and prevents a domain Predicate from knowing the shape of the whole application.
Type Parameters ​
• ModelType extends object
• Select extends TModelSliceSelector<ModelType, any>
• EventType extends number = number
• EventMetaType extends { [K in number]: any } = Record<EventType, unknown>
Parameters ​
• select: Select
• predicate: NoInfer<TModelSlicePredicate<ReturnType<Select>, EventType, EventMetaType>> & (event, slice) => unknown
Returns ​
TModelPredicate<ModelType, EventType, EventMetaType>