{"action":"created","issue":{"url":"https://api.github.com/repos/jhnns/rewire/issues/83","labels_url":"https://api.github.com/repos/jhnns/rewire/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/jhnns/rewire/issues/83/comments","events_url":"https://api.github.com/repos/jhnns/rewire/issues/83/events","html_url":"https://github.com/jhnns/rewire/pull/83","id":115695097,"number":83,"title":"Should not try to attach to modules that export primitives","user":{"login":"TheSavior","id":249164,"avatar_url":"https://avatars.githubusercontent.com/u/249164?v=3","gravatar_id":"","url":"https://api.github.com/users/TheSavior","html_url":"https://github.com/TheSavior","followers_url":"https://api.github.com/users/TheSavior/followers","following_url":"https://api.github.com/users/TheSavior/following{/other_user}","gists_url":"https://api.github.com/users/TheSavior/gists{/gist_id}","starred_url":"https://api.github.com/users/TheSavior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheSavior/subscriptions","organizations_url":"https://api.github.com/users/TheSavior/orgs","repos_url":"https://api.github.com/users/TheSavior/repos","events_url":"https://api.github.com/users/TheSavior/events{/privacy}","received_events_url":"https://api.github.com/users/TheSavior/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-11-07T21:54:57Z","updated_at":"2015-11-30T17:30:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jhnns/rewire/pulls/83","html_url":"https://github.com/jhnns/rewire/pull/83","diff_url":"https://github.com/jhnns/rewire/pull/83.diff","patch_url":"https://github.com/jhnns/rewire/pull/83.patch"},"body":"When people use rewire, they wouldn't typically try to explicitly rewire modules that export primitives. \r\n\r\nHowever, since reweireify, rewire-global, and babel-plugin-rewire all get injected to every module, this needs to not blow up on objects that can't be attached to.\r\n\r\nrewireify and rewire-global use `Object.isExtensible` instead of the type check. The behavior of `Object.isExtensible` change from es5 to es6. In ES5, it would throw if given something that was not an object. in ES6, it returns false. rewireify and rewire-global all run in the browser and all modern browsers have the es6 version of the functionality. Node 0.12 has the es5 functionality, so we need to use the type check instead.\r\n\r\nI added a test to make sure that it doesn't blow up on modules that return sealed objects. `Object.defineProperty` will run and not throw, but won't actually modify the object. "},"comment":{"url":"https://api.github.com/repos/jhnns/rewire/issues/comments/160697881","html_url":"https://github.com/jhnns/rewire/pull/83#issuecomment-160697881","issue_url":"https://api.github.com/repos/jhnns/rewire/issues/83","id":160697881,"user":{"login":"TheSavior","id":249164,"avatar_url":"https://avatars.githubusercontent.com/u/249164?v=3","gravatar_id":"","url":"https://api.github.com/users/TheSavior","html_url":"https://github.com/TheSavior","followers_url":"https://api.github.com/users/TheSavior/followers","following_url":"https://api.github.com/users/TheSavior/following{/other_user}","gists_url":"https://api.github.com/users/TheSavior/gists{/gist_id}","starred_url":"https://api.github.com/users/TheSavior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheSavior/subscriptions","organizations_url":"https://api.github.com/users/TheSavior/orgs","repos_url":"https://api.github.com/users/TheSavior/repos","events_url":"https://api.github.com/users/TheSavior/events{/privacy}","received_events_url":"https://api.github.com/users/TheSavior/received_events","type":"User","site_admin":false},"created_at":"2015-11-30T17:30:14Z","updated_at":"2015-11-30T17:30:14Z","body":"Good catch. Added a test case for null."}}