You maybe want to clarify here, whether `ext` needs a dot. I'd expect to call this like:
```
hasExtension(f, "pdf")
```
but not match a file named `foopdf`.