bartbutenaers / node-red-contrib-blockly

A Node Red node for visual programming a function using Blockly
Apache License 2.0
88 stars 22 forks source link

Buffer list conversions #120

Closed cymplecy closed 9 months ago

cymplecy commented 9 months ago

Add two blocks - one to convert from buffer to a list and another to convert from a list to a buffer

bartbutenaers commented 9 months ago

Hi @cymplecy,

Nice work!
Who would have ever thought that a die hard Blockly lover would start writing code generators ;-)

Only one small remark. Currently you generate code like this:

var mybuffer = Buffer.from('Hello Blockly!');
var mylist = [...mybuffer]

What would you think about generating this instead:

var mybuffer = Buffer.from('Hello Blockly!');
var mylist = Array.from(mybuffer);

Personally I like the latter more, because the square bracket statement is kind of mysterious to interpret. Moreover that way you generate two rather identical statements...

cymplecy commented 9 months ago

Hey - I only put in what google gives me :)

PR updated to use the old fashioned way :)

bartbutenaers commented 9 months ago

Yes the old fashioned way is most of the time the most easy to understand way ;-) I assume your Japanese knowledge is rather limited, since you haven't updated the ja.js file...

bartbutenaers commented 9 months ago

BTW my congratulations with your knowledge about the Dutch language. Perhaps we could communicate from here on in Dutch, so you can even extend your skills even more ;-)

cymplecy commented 9 months ago

:) I just used Snap! to find out the word for list in dutch :)

image