# Simplify JavaScript function node

**URL:** https://discourse.nodered.org/t/simplify-javascript-function-node/960
**Category:** Feature Requests
**Created:** [20 June 2018 17:51 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960 "2018-06-20T17:51:12Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Henry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henry/32/46636_2.png) [@Henry](https://discourse.nodered.org/u/Henry)
#### Post date: [20 June 2018 17:51 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960/1 "2018-06-20T17:51:12Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [20 June 2018 18:10 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960/2 "2018-06-20T18:10:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [20 June 2018 20:23 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960/3 "2018-06-20T20:23:01Z")

</div>

I’d be interested in what you have in mind . There are libraries like this - [https://github.com/bigeasy/packet](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

---

<div class="post-metadata">

### Author: ![machadotiago](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/machadotiago/32/23776_2.png) [@machadotiago](https://discourse.nodered.org/u/machadotiago)
#### Post date: [21 June 2018 13:26 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960/4 "2018-06-21T13:26:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Henry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/henry/32/46636_2.png) [@Henry](https://discourse.nodered.org/u/Henry)
#### Post date: [21 June 2018 13:37 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960/5 "2018-06-21T13:37:55Z")

</div>

I’ve found [https://developers.google.com/blockly/](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.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [22 June 2018 23:50 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960/6 "2018-06-22T23:50:47Z")

</div>

> [@Henry](#):
>
> I’ve found [https://developers.google.com/blockly/](https://developers.google.com/blockly/)

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

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [23 June 2018 06:48 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960/7 "2018-06-23T06:48:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [23 June 2018 16:38 UTC](https://discourse.nodered.org/t/simplify-javascript-function-node/960/8 "2018-06-23T16:38:25Z")

</div>

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

Sure:

> **[node-red-qnap-blockly](https://www.npmjs.com/package/node-red-qnap-blockly)**
>
> A blockly node for node-red. Latest version: 0.0.40, last published: 8 years ago. Start using node-red-qnap-blockly in your project by running \`npm i node-red-qnap-blockly\`. There are no other projects in the npm registry using node-red-qnap-blockly.
