Excellent info.
Firstly though, in order to make code more readable and importable it is important to post it between two sets of three backticks - ``` - see this post for more details - How to share code or flow json
Secondly, you don't have debug before the function. It is impossible to see what is going on to your function.
And again, your flow export is only the function. When exporting, select all nodes you wish to export before opening the export dialog.
Lastly, my suspicion was correct...
Watch this 4m video to understand what I mean.