Allow including urlsparse as a member of a closure

Currently the library is hardcoded to bind itself to window when not included on a commons JS project.

This patch allows the code to be bound to a custom closure. This make it possible to use the library on other runtimes like Rhino and include it on third party libraries without exposing it to the window.