Skip to content

Utils / Controller / splitBooleanOutputs

Function: splitBooleanOutputs()

ts
function splitBooleanOutputs(conditionTerm, msg): unknown[];

Splits a message into two outputs based on a boolean condition.

Parameters

ParameterTypeDescription

conditionTerm

boolean

The condition to evaluate. Expected to be a boolean (true or false).

msg

unknown

The message object to route based on the condition.

Returns

unknown[]

An array of two elements:

  • The first element contains the message if conditionTerm is true, otherwise null.
  • The second element contains the message if conditionTerm is false, otherwise null.

Example

ts
const msg = { payload: 'Hello, world!' };
const result = splitBooleanOutputs(true, msg);
console.log(result); // Output: [{ payload: 'Hello, world!' }, null]

Version v1.33.1 - Built on 2026-03-28