improve formatting consistency

Feel free to cherry-pick if you're not happy with some of the changes.

I couldn't be sure which style you prefer for object literals, since both the following styles appear in various places:

```javascript
{ foo: 1, bar: 2 }
{ foo : 1, bar : 2 }
```

I opted for the former since it's closer to the `{foo: 1, bar: 2}` style that's probably most common. If you prefer to latter, I'll happily update the commit.