You should do this in the `setBaseUrl` so as to do this only once, and not on every URL call.

Also, use `_.last` from lodash.

`_.last(baseUrl) === '/' ? _.initial(baseUrl) : baseUrl` in the setter.