Made it prettier

moved require('path').basename outside of the function