added component support and fixed commonjs module.exports

This pull request will allow store.js to support component (http://github.com/component/component)

Also fixed the module.exports bit. Used this check instead: http://stackoverflow.com/a/15036162/145435