Change typeof module from 'function' to 'require' to match Node.js

Fixes #19, and component/component#384.