hyperflow
hyperflow copied to clipboard
Function 'ins' and 'outs' as array-like objects
Function ins
and outs
are now Array-like objects, so that you can refer to an input/ouput by its index ins[0]
OR its name ins.sig1
(they refer to the same object). However, array-like behavior is still retained, e.g. ins.forEach
, ins.length
.
How it works example: https://github.com/dice-cyfronet/hyperflow/blob/develop/test/funcarg.js
Related commits:
- fdfa15207ec7de986ec6273c46d828e770f47f61
- 8d50f74d59b8b007a35131ee84a5b1038505019a
@balis: Serializing ins
to JSON renders invalid output. Instead Array
I get:
{
"inputs": {
"/etc/passwd": {
"_id": 1,
"data": [
"/etc/passwd"
],
"name": "/etc/passwd",
"sigIdx": 1
},
"0": {
"_id": 1,
"data": [
"/etc/passwd"
],
"name": "/etc/passwd",
"sigIdx": 1
},
"length": 1
}
}
The workaround is to use the following instead of ins
=> ins.map(function(id){return id})
.
This looks as expected - array-like object, not array. What is the context of the problem? JSON.stringify? This also works (tested): var properArray = Array.prototype.slice.call(arrayLikeObject);