Fix dir method to not output color token

I ran into an issue with console.dir showing a %c token since it doesn't handle colors, so I check for the method and only use colors if supported.

In the process I made some fixes so it would conform to JSHint.