Maybe just use this (untested):

```
find engines/bastion/ -path engines/bastion/node_modules -prune -o -name '*.js' | xargs perl -pi -e 's:function\((.*)\){:function(\1) {:g'
```