Function to be shared by rules as well as custom database scripts

I wanted to ask how do I make a function sharable between both rules and the create/login etc. custom db scripts?

For rules, based on this Using a function in multiple rules - the answer is to run a rule at the top that sets up a bunch of shared functions/vars that the rest of the rules can consume.

How can I make it so that my login and create scripts would also have access to those functions?

Hey there!

Basically what you said already rules are executed in specified order, from the top to bottom and they are run upon successful login

Yes, for rules, I understand - I am looking for a way to share code between my custom database scripts for create.js, login.js, verify.js etc.