Function
Key
The function key can match any of the following:
- fn
- func
- function
Format
Functions are defined as a string with the following format:
Function Key
The function option lets you choose any of the available functions passed in to the parseString/.t function.
The format is fn: [function.key]
where [function.key]
is the key of the potentially deeply nested function you want to call in the functions object.
Parameters
Parameters are optional and are passed in as an array of pre-parsed (as in, are their parsed values by the time they hit the function) values. These can be any of the parameter types discussed in this category of the documentation. (i.e. string, number, boolean, key, function)
To define parameters, you can use the following format:
DX
Various bits and pieces are in place to hopefully improve the developer experience with using the function parameter type.
For instance, parameters (this isn’t exclusive to the function type) all don’t care too much about spaces and newlines. The only real restriction here is that the border of the function key string and the parameters string must be right next to eachother. This means that you can write the following:
and it will be completely valid. The output of that would be a 2 false Hello World! Hello from within!
for those that are curious.
Additionally, Common > Borders and Common > Escaping apply here, making it possible to nest function and parameters.
Signature
Functions are called with the following signature:
This allows you to access the context and other functions from within the function.
If you’re intending for a function to be used as a matcher, you should probably have it output a string, boolean, or number. This is dependant on what you’re using the function in of course. Experimentation is key here.