added typecheck for metadata setter function

I ran into an odd scenario when using the grunt-metalsmith plugin that invokes `new Metalsmith()` and assumes the user defines a metadata object literal at the very least since it calls `metalsmith.metadata(options.metadata)` without any checks. I started the think, maybe a simple conditional should be used here to catch this but came to the conclusion this may not be the best solution. Since a few metalsmith plugins, including contrib segmentio plugins, make a call to metalsmith.metadata() and expect it to be an object without any conditional checks maybe metalsmith should ensure an object is all that can be set here. Instead of invoking pull requests throughout the number of plugins who function this way I thought it should be fixed at the root. I have also included a few test scenarios to make sure only an object is allowed to be set and an object is always returned. Let me know if I am wrong in thinking this and I can adjust the pull request accordingly.