Hi welcome to the node-red forum.
Can you please edit your post
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