Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "api/dsl/decisionTree"

Index

Classes

Functions

Functions

given

  • Simple DSL to create a decision tree. Trees and subtrees can compute variables as interim values for future use. Example usage, showing computed state:

    let count = 0;  // Initialize a counter we'll use later
    const pm: PushMapping<Goals> = given<Goals>(TruePushTest, ...) // Use any push tests
       .init(() => count = 0) // Init to set state
       .itMeans("no frogs coming")
       .then(
           given<Goals>(TruePushTest, ...).itMeans("case1")
              .compute(() => count++)   // Increment the counter for this branch
              .then(
                 // Compute terminal rules
                 whenPushSatisfies(count > 0, FalsePushTest).itMeans("nope").setGoals(NoGoals),
                 whenPushSatisfies(TruePushTest).itMeans("yes").setGoals(HttpServiceGoals),
              ),
          );
    

    Type parameters

    • V

    Parameters

    • Rest ...givenPushTests: PushTest[]

      PushTests

    Returns TreeContext<V>

    interim DSL structure

Generated using TypeDoc