1.0.1 • Published 7 years ago

node-red-contrib-frp v1.0.1

Weekly downloads
5
License
ISC
Repository
github
Last release
7 years ago

node-red-contrib-frp

A collection of Node-RED nodes that use FRP to perform stream manipulation.

frp-map

This node maps msg.payload using the specified mapping function.

Inputs

  • payload: Data inside the incoming message. Can be renamed to any variable name you prefer in the mapping function

Outputs

  • payload: Value returned by the node's mapping function.
  • topic: A mandatory property used to identify the origin of a message. This is used by the combine nodes to process multiple inputs, and should not contain spaces or periods.

Mapping Function

The frp-map node allows you to define the body of the internal mappingFunction. Naming the function is not necessary as it is already defined internally. The mapping function can only contain one input parameter and is required to return a value, which is stored in the message's payload.

frp-filter

This node allows incoming messages to pass through if it fulfills the criteria specified in the filtering function.

Inputs

  • payload: Data inside msg.payload of the incoming message. Can be renamed to any variable name you prefer in the filtering function.

Outputs

  • topic: A mandatory property used to identify the origin of a message. This is used by the combine nodes to process multiple inputs, and should not contain spaces or periods.

Filtering Function

The frp-filter node allows you to define the body of the internal filteringFunction. Naming the function is not necessary as it is already defined internally. The filtering function discerns if the data inside the message (contained in msg.payload) passes a certain criteria. Therefore, the function should have one input parameter and return either true or false. It's also important to note that frp-filter does not change the contents of the message, and only decides whether or not to pass it along.

frp-scan

This node performs a fold operation for every incoming message: it takes the value of msg.payload and runs it through the accumulator function, storing and returning an accumulated value from the first to the latest input.

Inputs

  • payload: The initial value used for accumulation.
  • payload: Data inside msg.payload of the incoming message. Can be renamed to any variable name you prefer in the accumulator function.
  • accumulatedValue: Value obtained from computing the previous message with the accumulator function. Can be renamed to any variable name you prefer in the accumulator function.

Outputs

  • payload: Contains the accumulated value obtained from the accumulator function.
  • topic: A mandatory property used to identify the origin of a message. This is used by the combine nodes to process multiple inputs, and should not contain spaces or periods.

Accumulator Function

frp-scan requires you to define the body of the internal accumulatorFunction. Naming the function is not necessary as it is already defined internally. The accumulator function must have two parameters: the first being accumultedValue, followed by payload. For the very first run, the seed value serves as the accumulated value, and the result is then stored and used for subsequent runs. This function must therefore return a value in order for it to work properly.

frp-combineAsArray

This node combines the msg.payload's of its inputs into an array and outputs it.

Inputs

  • input topics: A list containing the topics of the input nodes that can be reordered.

Outputs

  • payload: Contains the accumulated value obtained from the accumulator function.
  • topic: A mandatory property used to identify the origin of a message. This is used by the combine nodes to process multiple inputs, and should not contain spaces or periods.

frp-combineWith

This node combines the msg.payload's of its inputs into an array and outputs it.

Inputs

  • input topics: A list containing the topics of the input nodes that can be reordered.
  • payload1, payload2, ...: Data contained in the msg.payload's of the input nodes. Their order should be the same as that of input topics

Outputs

  • payload: Contains the accumulated value obtained from the accumulator function.
  • topic: A mandatory property used to identify the origin of a message. This is used by the combine nodes to process multiple inputs, and should not contain spaces or periods.

Aggregator Function

frp-combineWith requires you to define the body of the internal aggregateFunction. Naming the function is not necessary as it is already defined internally. The aggregator function must have as many parameters as there are input topics, and must observe the correct order. It must also return a value for it to work properly.