How to restrict global scope in dynamically created function? - Deno