Rewrite: abstract the common logic between Node.js and the browser

Hey TJ! Hope all is well.

So I basically got fed up with the diverging browser and node implementations of `debug()`, and wanted to abstract as much of that as possible into common logic reusable on both sides. I kinda went full retard…

There should be virtually ___no___ changes to this module's behavior, other then that it exports a few more implementation details now, but that shouldn't bother anybody, and the logic is cleaner now since it's shared on the client and server.

I hope you like it, cheers!