I've added the Modulator.getType() function now, works perfectly.
I've pushed my latest changes to my feature branch. This is up to date with the latest commits in @Christoph-Hart's scriptnode branch which means that it will be easy for him to merge my pull request ;)
There is one breaking change in my branch. I added an additional parameter to the FileSystem.browse function. The fourth parameter is now a boolean that you can use to specify if you want to browse for directories rather than files.