Skip to content

Utils / Controller / useControllerNode

Function: useControllerNode()

ts
function useControllerNode(
   node, 
   msg, 
   opts?): object;

A hook-like function that provides utilities for evaluating Node-RED properties within a custom node. It includes property evaluation with default values and quick property evaluation with type enforcement.

Parameters

ParameterTypeDescription

node

Node

The Node-RED node instance.

msg

NodeMessage

The message object passing through the node.

opts?

{ typedSuffix: string; }

Optional configuration for property evaluation.

opts.typedSuffix?

string

The suffix used to determine the type of a property.

Returns

An object containing utility functions for evaluating node properties.

NameTypeDefault value

evaluateNodeProperty()

(value, type) => Promise<[Error | undefined, any]>

evaluateNodePropertyWithDefaults

quickNodePropertyEval()

<T>(bag, term, quickOpts?) => Promise<any>

Example

ts
const controller = useControllerNode(node, msg);

// Evaluate a property
const [error, value] = await controller.evaluateNodeProperty('someValue', 'msg');

// Quickly evaluate a property from an object
const result = await controller.quickNodePropertyEval({ foo: 'bar' }, 'foo');

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