Fix CommonJS detection to work in Component package manager

`typeof module == "object"` breaks inside [Component](https://github.com/component/component) (where it's a function). CommonJS spec is ambiguous on the issue (See #307). Using more common `typeof module !== "undefined" && module.exports`.