NodeJS Custom Formatters - parameters not as expected

I’ve become more and more reliant on creating custom formatters, especially for Math (damned JS floating point calculations) and custom date calculations, but I have just come across something new that I haven’t noticed before now having never used more than one function parameter.

As you can see below, I have 3 variables (random string was for debugging):

Yet I have had to add the following to my function for the parameters to line up correctly:
image
image

It took me until adding a random string variable in to see that I needed val as the first parameter because the rest were misaligned.

Has it always been the case that val is always the element the formatter is attached to, and the rest of the values come afterwards? Unless I’m blind (most likely), then I haven’t found this in any documentation.

If so, does that mean I can drop the variables in my HJSON when I only need one parameter (the element attached to the formatter)?

Cheers
Michael

Community Page
Last updated: