e.g can I access the name as a variable inside the function?
yes you can actually, it's listed on the "writing functions" doc page:
node.name
https://nodered.org/docs/user-guide/writing-functions#node
Now, if only there was a built-in property for node.outputs
(how many output ports are defined)...
or better yet, an array of output definitions (with labels and such).