Refactor url-utils package
Problem
url-utils package has too many intermingled functions in a single index.js file.
Goal
Have package build from a set of smaller functions which would be as pure as possible.
Context
After extracting url-utils package from Ghost core (https://github.com/TryGhost/Ghost-SDK/pull/114) it was hard to break up a package into smaller pieces right away. The main reason is calls between the functions are to dependent on one another. For example, the getSubdir method is being called almost from every function and sometimes is even nested as a call from deduplicateSubDir. Another pain point is urlJoin method, which operates on arguments directly and adding any parameters to it would need some more thinking (because it possibly could change existing API).
Possible approaches
To decouple methods from getSubdir it could be extracted into function parameters instead.
The urlJoin method could be wrapped to keep accepting no parameters. The wrapper would call internal urlJoinInternal method with first parameter as an options object containing subdir value: urlJoinInternal({subdir: getSubdir()}, ...arguments).
TODO
Possible approaches section needs more research and discussion.