langalex/couch_potato — pull request #101 by andymorris (2014-07-31 21:30:55+00:00)
Title: Handle CommonJS modules with module.exports as well as exports

This came about because my team was trying to include [moment-timezone](https://github.com/moment/moment-timezone/) in a view as a CommonJS module. Actually running the view in couchdb worked fine, but our map/reduce specs did not work.

It turned out that moment-timezone exports its functionality for CommonJS using the `module.exports` object instead of the `exports` object. Both appear to be valid ways for libraries to support CommonJS, though I haven't had luck finding an official spec that explains this, only several blog posts and explanations like [this](http://stackoverflow.com/a/5311377).