{"action":"created","issue":{"url":"https://api.github.com/repos/sindresorhus/pify/issues/8","labels_url":"https://api.github.com/repos/sindresorhus/pify/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/sindresorhus/pify/issues/8/comments","events_url":"https://api.github.com/repos/sindresorhus/pify/issues/8/events","html_url":"https://github.com/sindresorhus/pify/issues/8","id":105608021,"number":8,"title":"Edge case: pify.all() when module is a function","user":{"login":"dsblv","id":1024980,"avatar_url":"https://avatars.githubusercontent.com/u/1024980?v=3","gravatar_id":"","url":"https://api.github.com/users/dsblv","html_url":"https://github.com/dsblv","followers_url":"https://api.github.com/users/dsblv/followers","following_url":"https://api.github.com/users/dsblv/following{/other_user}","gists_url":"https://api.github.com/users/dsblv/gists{/gist_id}","starred_url":"https://api.github.com/users/dsblv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsblv/subscriptions","organizations_url":"https://api.github.com/users/dsblv/orgs","repos_url":"https://api.github.com/users/dsblv/repos","events_url":"https://api.github.com/users/dsblv/events{/privacy}","received_events_url":"https://api.github.com/users/dsblv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-09T14:26:46Z","updated_at":"2015-09-09T16:02:12Z","closed_at":null,"body":"I noticed that when pify promisifies a module, it stores methods in newly-created object. This means if the module is a function with attached methods (like pify itself), `pify.all()` promicifies methods, but loses the main function.\r\n\r\n```js\r\nfunction fn(x, cb) {\r\n\tsetImmediate(function () {\r\n\t\tcb(null, x);\r\n\t});\r\n}\r\n\r\nfn.meow = function (cb) {\r\n\tsetImmediate(function () {\r\n\t\tcb(null, 'meow');\r\n\t});\r\n};\r\n\r\nvar pfn = pify.all(fn);\r\n\r\npfn.meow().then(function (data) {\r\n\tconsole.log(data);\r\n\t//=> 'meow'\r\n});\r\n\r\npfn('hi').then();\r\n//=> nope, pfn is not a function\r\n```"},"comment":{"url":"https://api.github.com/repos/sindresorhus/pify/issues/comments/138957140","html_url":"https://github.com/sindresorhus/pify/issues/8#issuecomment-138957140","issue_url":"https://api.github.com/repos/sindresorhus/pify/issues/8","id":138957140,"user":{"login":"dsblv","id":1024980,"avatar_url":"https://avatars.githubusercontent.com/u/1024980?v=3","gravatar_id":"","url":"https://api.github.com/users/dsblv","html_url":"https://github.com/dsblv","followers_url":"https://api.github.com/users/dsblv/followers","following_url":"https://api.github.com/users/dsblv/following{/other_user}","gists_url":"https://api.github.com/users/dsblv/gists{/gist_id}","starred_url":"https://api.github.com/users/dsblv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsblv/subscriptions","organizations_url":"https://api.github.com/users/dsblv/orgs","repos_url":"https://api.github.com/users/dsblv/repos","events_url":"https://api.github.com/users/dsblv/events{/privacy}","received_events_url":"https://api.github.com/users/dsblv/received_events","type":"User","site_admin":false},"created_at":"2015-09-09T16:02:12Z","updated_at":"2015-09-09T16:02:12Z","body":"This is exactly what I was thinking about.\r\n\r\nOne thing: how to tell pify whether it should process that function or not? Add another option? Or some magic word to look for in `include/exclude` array?"}}