Skip to content

Packages  ›  trotsky  ›  StepWhen

StepWhen class

Represents a conditional step that evaluates a predicate to determine its outcome.

Signature:

typescript
export declare class StepWhen<P = StepBuilder, C = unknown, O = boolean> extends Step<P, C, O>

Extends: Step<P, C, O>

Remarks

This step evaluates a predicate, which can be a boolean value or a resolvable that resolves to a boolean. The result of the predicate evaluation is stored in the output.

Constructors

Constructor

Modifiers

Description

(constructor)(agent, parent, predicate)

Creates an instance of StepWhen.

Methods

Method

Modifiers

Description

apply()

Evaluates the predicate and sets the output to its result.

clone(rest)

Clones the current step and returns a new instance with the same parameters.