Extract format module

Extract formatting utils used by unhandled rejection reporting, and add some unit tests.

See also #412 
Looks like buster 0.7 (which when.js depends on) supports CommonJS: https://github.com/busterjs/buster/blob/master/lib/buster.js