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
| Parameter | Type | Description |
|---|---|---|
|
| The Node-RED node instance. |
|
| The message object passing through the node. |
| { | Optional configuration for property evaluation. |
|
| The suffix used to determine the type of a property. |
Returns
An object containing utility functions for evaluating node properties.
| Name | Type | Default value |
|---|---|---|
| ( |
|
| < | ‐ |
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');