convertRuleStructToString(functionString, encodedValues, ruleS, plhArray): ruleJSON

Converts a RuleStruct object into a JSON-like string representation.

Parameters

ParameterTypeDescription
functionStringstringThe function signature as a string.
encodedValuesstringA string containing encoded values for the rule.
ruleSRuleStructThe RuleStruct object containing rule details such as placeholders, positive effects, and negative effects.
plhArraystring[]An array to store the names of placeholders extracted from the rule.

Returns

ruleJSON

An object of type ruleJSON containing the condition, positive effects, negative effects, function signature, and encoded values.

The function processes the RuleStruct object to:

  • Extract placeholder names and append them to plhArray.
  • Parse and format positive and negative effects into strings.
  • Reverse parse the rule’s instruction set to generate a condition string.
  • Populate the ruleJSON object with the processed data.

Defined in

src/modules/parser.ts:598