You can define custom functions and make them available in templates:
https://codeeval.dev/gist/7a82beab88024732f5561ec29e7008e2