behave more like JSON.stringify

This fixes a few things to make `msgpack.encode` behave more like `JSON.stringify`

In particular, it ignores functions instead of throwing, and it respects `toJSON`,
so that regular expressions, dates, and so on convert to msgpack as they would with JSON.

Also, tests are provided for these features.