semantics are the same as unix `basename` which will return the name of a directory.  the reasoning i think is that in the case of `/path/to/dir` we don't know it's a dir so have to return `dir` and it is confusing if `/path/to/dir/` and `/path/to/dir` return different values.

i think we should change it to `getBasename` however.  will do that, then merge (following your comment).