Simplify JavaScript function node

#1

So I found node red “making” things easier to by connection dots to each other and setting up some property’s. easy peasy right? NO!

When it comes to data-streams (tcp/ip,serial) mostly a Function node is being used to split/extract the data which is coded with javascript. As I’m not a programmer the “function” node is useless for me. I can trial and error on samples, but that’s not helping me.

So isn’t a way to generate javascript by sort off a GUI like a flow inside a Function node so U can strip the data that way?

0 Likes

[ANNOUNCE] Visual programming a function node with Blockly - Feedback request
#2

Node-red is a gui for creating flows that can be used to manipulate data.

The Function node is there for when a task cannot be completed with the available nodes.

I would be interested to hear what sort of uses you have where you need to go straight to the Function node. You mention splitting data… Does the Split node not meet your nodes? What functionality is it missing from your perspective?

We aren’t going to invest energy in creating another graphical abstraction for defining flow logic when that is exactly what node-red already does.

0 Likes

#3

I’d be interested in what you have in mind . There are libraries like this - https://github.com/bigeasy/packet - that allow you to specify how a message packet is built up (IE like a structure, or struct in C, or template) - but imho it is even more complex than a function and yet another syntax to learn. What is the exact use case you are trying to solve and are there any other tools out there that do do a good job that you could point us at an example ?

PS we do have that binary lib wrapped as a node - node-red-contrib-binary

0 Likes

#4

I saw many examples on the internet of people using the function node when it’s actually not required. Most of the issues for treating data can be easily fixed by using the “change”, “switch”, “split” and “join” nodes. We did and exercise here in our company to vanish the usage of the function node and it was extremely successful.

0 Likes

#5

I’ve found https://developers.google.com/blockly/ but it won’t allow reverse the code the other way around so I can create GUI javascript from javascript code and trial and error from there.

I’d like to “process” a HTTP CGI request and process a UART serial stream.

CGI
input -> HTTP request -> io_alias.cgi -> debug

serial :
extract hex 15-18 -> output
extract hex 19-22 -> output
extract hex 39-42 -> output
ect…

I’d like to see more Examples for the nodes/examples.
Just text doesn’t cut it.

0 Likes

#6

There is a blockly node but it hasn’t been updated in ages. Possibly abandoned.

0 Likes

#7

Hi Julian (@TotallyInformation), could you provide a link to that blocky contribution. For some reason I cannot find it …
Thanks, Bart

0 Likes

#8

Sure:

https://www.npmjs.com/package/node-red-qnap-blockly

0 Likes