Are you an LLM? You can read better optimized documentation at /en\tutorial\override\JavaScript.md for this page in Markdown format
JavaScript
Use JavaScript to modify the config. The entry point is the main function, which receives one config argument (the name is up to you) and returns it after modification.
The example below inserts a rule at the start of rules.
javascript
function main(config) {
config.rules.unshift("DOMAIN,google.com,DIRECT");
return config;
}