{"action":"created","comment":{"url":"https://api.github.com/repos/stampit-org/stampit/pulls/comments/33413302","id":33413302,"diff_hunk":"@@ -21,38 +19,40 @@ import {\n } from 'supermixer';\n \n const create = Object.create;\n+function isThenable(value) {\n+  return value && isFunction(value.then);\n+}\n \n function extractFunctions(...args) {\n+  const result = [];\n   if (isFunction(args[0])) {\n-    return map(args, fn => {\n+    forEach(args, fn => { // assuming all the arguments are functions\n       if (isFunction(fn)) {\n-        return fn;\n+        result.push(fn);\n       }\n     });\n   } else if (isObject(args[0])) {\n-    const arr = [];\n     forEach(args, obj => {\n-      forOwn(obj, fn => {\n+      forEach(obj, fn => {\n         if (isFunction(fn)) {\n-          arr.push(fn);\n+          result.push(fn);\n         }\n       });\n     });\n-    return arr;\n   }\n-  return [];\n+  return result;\n }\n \n function addMethods(fixed, ...methods) {\n   return mixinFunctions(fixed.methods, ...methods);\n }\n function addRefs(fixed, ...refs) {\n-  fixed.refs = fixed.state = mixin(fixed.refs || fixed.state, ...refs);\n+  fixed.refs = fixed.state = mixin(fixed.refs, ...refs);\n   return fixed.refs;\n }\n function addInit(fixed, ...inits) {\n   const extractedInits = extractFunctions(...inits);\n-  fixed.init = fixed.enclose = (fixed.init || fixed.enclose).concat(extractedInits);\n+  fixed.init = fixed.enclose = fixed.init.concat(extractedInits);","path":"src/stampit.js","position":57,"original_position":57,"commit_id":"7094d5bbedc713b53fcb04e2c74c19f3b92ccafe","original_commit_id":"4e68de51476c5c05c2de1a34ff30abf58f9875f4","user":{"login":"koresar","id":1622575,"avatar_url":"https://avatars.githubusercontent.com/u/1622575?v=3","gravatar_id":"","url":"https://api.github.com/users/koresar","html_url":"https://github.com/koresar","followers_url":"https://api.github.com/users/koresar/followers","following_url":"https://api.github.com/users/koresar/following{/other_user}","gists_url":"https://api.github.com/users/koresar/gists{/gist_id}","starred_url":"https://api.github.com/users/koresar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koresar/subscriptions","organizations_url":"https://api.github.com/users/koresar/orgs","repos_url":"https://api.github.com/users/koresar/repos","events_url":"https://api.github.com/users/koresar/events{/privacy}","received_events_url":"https://api.github.com/users/koresar/received_events","type":"User","site_admin":false},"body":"I'd stand for readability here. Explicit `contact` makes it clear for everyone. Whereas not every developers knows the ES6 syntax.\r\n\r\nAnd also performance. :)","created_at":"2015-06-27T15:22:16Z","updated_at":"2015-06-27T15:22:16Z","html_url":"https://github.com/stampit-org/stampit/pull/129#discussion_r33413302","pull_request_url":"https://api.github.com/repos/stampit-org/stampit/pulls/129","_links":{"self":{"href":"https://api.github.com/repos/stampit-org/stampit/pulls/comments/33413302"},"html":{"href":"https://github.com/stampit-org/stampit/pull/129#discussion_r33413302"},"pull_request":{"href":"https://api.github.com/repos/stampit-org/stampit/pulls/129"}}},"pull_request":{"url":"https://api.github.com/repos/stampit-org/stampit/pulls/129","id":38650120,"html_url":"https://github.com/stampit-org/stampit/pull/129","diff_url":"https://github.com/stampit-org/stampit/pull/129.diff","patch_url":"https://github.com/stampit-org/stampit/pull/129.patch","issue_url":"https://api.github.com/repos/stampit-org/stampit/issues/129","number":129,"state":"open","locked":false,"title":"Stamps as promised","user":{"login":"koresar","id":1622575,"avatar_url":"https://avatars.githubusercontent.com/u/1622575?v=3","gravatar_id":"","url":"https://api.github.com/users/koresar","html_url":"https://github.com/koresar","followers_url":"https://api.github.com/users/koresar/followers","following_url":"https://api.github.com/users/koresar/following{/other_user}","gists_url":"https://api.github.com/users/koresar/gists{/gist_id}","starred_url":"https://api.github.com/users/koresar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koresar/subscriptions","organizations_url":"https://api.github.com/users/koresar/orgs","repos_url":"https://api.github.com/users/koresar/repos","events_url":"https://api.github.com/users/koresar/events{/privacy}","received_events_url":"https://api.github.com/users/koresar/received_events","type":"User","site_admin":false},"body":"What's been done:\r\n* You can return `Promise`'s from the `init()` function(s). I.e.\r\n```js\r\nstampit.init(() => Promise.resolve({ newInstance: 'data' }))\r\n  .create().then((myNewInstance) => {\r\n    // do things with myNewInstance\r\n  });\r\n```\r\nIf any of the `init`'s return promise, then doesn't matter what, the stamp will return a promise too. See `test/promise-init.js`\r\n\r\n* Coverage top up to 100%. Added few more tests for that. Removed a code which is impossible to hit.\r\n* Removed the dependency on the lodash functions: `map` and `forOwn`. The `stampit.min.js` got shorter even though I've added Promises support. :)","created_at":"2015-06-26T13:41:53Z","updated_at":"2015-06-27T15:22:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b38954ca80991d932f5ec1d96bdd63b80ca5227","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/stampit-org/stampit/pulls/129/commits","review_comments_url":"https://api.github.com/repos/stampit-org/stampit/pulls/129/comments","review_comment_url":"https://api.github.com/repos/stampit-org/stampit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stampit-org/stampit/issues/129/comments","statuses_url":"https://api.github.com/repos/stampit-org/stampit/statuses/7094d5bbedc713b53fcb04e2c74c19f3b92ccafe","head":{"label":"stampit-org:stamps-as-promised","ref":"stamps-as-promised","sha":"7094d5bbedc713b53fcb04e2c74c19f3b92ccafe","user":{"login":"stampit-org","id":12635305,"avatar_url":"https://avatars.githubusercontent.com/u/12635305?v=3","gravatar_id":"","url":"https://api.github.com/users/stampit-org","html_url":"https://github.com/stampit-org","followers_url":"https://api.github.com/users/stampit-org/followers","following_url":"https://api.github.com/users/stampit-org/following{/other_user}","gists_url":"https://api.github.com/users/stampit-org/gists{/gist_id}","starred_url":"https://api.github.com/users/stampit-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stampit-org/subscriptions","organizations_url":"https://api.github.com/users/stampit-org/orgs","repos_url":"https://api.github.com/users/stampit-org/repos","events_url":"https://api.github.com/users/stampit-org/events{/privacy}","received_events_url":"https://api.github.com/users/stampit-org/received_events","type":"Organization","site_admin":false},"repo":{"id":8124664,"name":"stampit","full_name":"stampit-org/stampit","owner":{"login":"stampit-org","id":12635305,"avatar_url":"https://avatars.githubusercontent.com/u/12635305?v=3","gravatar_id":"","url":"https://api.github.com/users/stampit-org","html_url":"https://github.com/stampit-org","followers_url":"https://api.github.com/users/stampit-org/followers","following_url":"https://api.github.com/users/stampit-org/following{/other_user}","gists_url":"https://api.github.com/users/stampit-org/gists{/gist_id}","starred_url":"https://api.github.com/users/stampit-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stampit-org/subscriptions","organizations_url":"https://api.github.com/users/stampit-org/orgs","repos_url":"https://api.github.com/users/stampit-org/repos","events_url":"https://api.github.com/users/stampit-org/events{/privacy}","received_events_url":"https://api.github.com/users/stampit-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stampit-org/stampit","description":"OOP is better with stamps: Composable object factories.","fork":false,"url":"https://api.github.com/repos/stampit-org/stampit","forks_url":"https://api.github.com/repos/stampit-org/stampit/forks","keys_url":"https://api.github.com/repos/stampit-org/stampit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stampit-org/stampit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stampit-org/stampit/teams","hooks_url":"https://api.github.com/repos/stampit-org/stampit/hooks","issue_events_url":"https://api.github.com/repos/stampit-org/stampit/issues/events{/number}","events_url":"https://api.github.com/repos/stampit-org/stampit/events","assignees_url":"https://api.github.com/repos/stampit-org/stampit/assignees{/user}","branches_url":"https://api.github.com/repos/stampit-org/stampit/branches{/branch}","tags_url":"https://api.github.com/repos/stampit-org/stampit/tags","blobs_url":"https://api.github.com/repos/stampit-org/stampit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stampit-org/stampit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stampit-org/stampit/git/refs{/sha}","trees_url":"https://api.github.com/repos/stampit-org/stampit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stampit-org/stampit/statuses/{sha}","languages_url":"https://api.github.com/repos/stampit-org/stampit/languages","stargazers_url":"https://api.github.com/repos/stampit-org/stampit/stargazers","contributors_url":"https://api.github.com/repos/stampit-org/stampit/contributors","subscribers_url":"https://api.github.com/repos/stampit-org/stampit/subscribers","subscription_url":"https://api.github.com/repos/stampit-org/stampit/subscription","commits_url":"https://api.github.com/repos/stampit-org/stampit/commits{/sha}","git_commits_url":"https://api.github.com/repos/stampit-org/stampit/git/commits{/sha}","comments_url":"https://api.github.com/repos/stampit-org/stampit/comments{/number}","issue_comment_url":"https://api.github.com/repos/stampit-org/stampit/issues/comments{/number}","contents_url":"https://api.github.com/repos/stampit-org/stampit/contents/{+path}","compare_url":"https://api.github.com/repos/stampit-org/stampit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stampit-org/stampit/merges","archive_url":"https://api.github.com/repos/stampit-org/stampit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stampit-org/stampit/downloads","issues_url":"https://api.github.com/repos/stampit-org/stampit/issues{/number}","pulls_url":"https://api.github.com/repos/stampit-org/stampit/pulls{/number}","milestones_url":"https://api.github.com/repos/stampit-org/stampit/milestones{/number}","notifications_url":"https://api.github.com/repos/stampit-org/stampit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stampit-org/stampit/labels{/name}","releases_url":"https://api.github.com/repos/stampit-org/stampit/releases{/id}","created_at":"2013-02-10T16:20:49Z","updated_at":"2015-06-27T14:52:21Z","pushed_at":"2015-06-27T15:16:05Z","git_url":"git://github.com/stampit-org/stampit.git","ssh_url":"git@github.com:stampit-org/stampit.git","clone_url":"https://github.com/stampit-org/stampit.git","svn_url":"https://github.com/stampit-org/stampit","homepage":"http://pjabook.com","size":1574,"stargazers_count":959,"watchers_count":959,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":14,"forks":47,"open_issues":14,"watchers":959,"default_branch":"master"}},"base":{"label":"stampit-org:master","ref":"master","sha":"1fef132145decbd074b3de28e1243468eb290045","user":{"login":"stampit-org","id":12635305,"avatar_url":"https://avatars.githubusercontent.com/u/12635305?v=3","gravatar_id":"","url":"https://api.github.com/users/stampit-org","html_url":"https://github.com/stampit-org","followers_url":"https://api.github.com/users/stampit-org/followers","following_url":"https://api.github.com/users/stampit-org/following{/other_user}","gists_url":"https://api.github.com/users/stampit-org/gists{/gist_id}","starred_url":"https://api.github.com/users/stampit-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stampit-org/subscriptions","organizations_url":"https://api.github.com/users/stampit-org/orgs","repos_url":"https://api.github.com/users/stampit-org/repos","events_url":"https://api.github.com/users/stampit-org/events{/privacy}","received_events_url":"https://api.github.com/users/stampit-org/received_events","type":"Organization","site_admin":false},"repo":{"id":8124664,"name":"stampit","full_name":"stampit-org/stampit","owner":{"login":"stampit-org","id":12635305,"avatar_url":"https://avatars.githubusercontent.com/u/12635305?v=3","gravatar_id":"","url":"https://api.github.com/users/stampit-org","html_url":"https://github.com/stampit-org","followers_url":"https://api.github.com/users/stampit-org/followers","following_url":"https://api.github.com/users/stampit-org/following{/other_user}","gists_url":"https://api.github.com/users/stampit-org/gists{/gist_id}","starred_url":"https://api.github.com/users/stampit-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stampit-org/subscriptions","organizations_url":"https://api.github.com/users/stampit-org/orgs","repos_url":"https://api.github.com/users/stampit-org/repos","events_url":"https://api.github.com/users/stampit-org/events{/privacy}","received_events_url":"https://api.github.com/users/stampit-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stampit-org/stampit","description":"OOP is better with stamps: Composable object factories.","fork":false,"url":"https://api.github.com/repos/stampit-org/stampit","forks_url":"https://api.github.com/repos/stampit-org/stampit/forks","keys_url":"https://api.github.com/repos/stampit-org/stampit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stampit-org/stampit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stampit-org/stampit/teams","hooks_url":"https://api.github.com/repos/stampit-org/stampit/hooks","issue_events_url":"https://api.github.com/repos/stampit-org/stampit/issues/events{/number}","events_url":"https://api.github.com/repos/stampit-org/stampit/events","assignees_url":"https://api.github.com/repos/stampit-org/stampit/assignees{/user}","branches_url":"https://api.github.com/repos/stampit-org/stampit/branches{/branch}","tags_url":"https://api.github.com/repos/stampit-org/stampit/tags","blobs_url":"https://api.github.com/repos/stampit-org/stampit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stampit-org/stampit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stampit-org/stampit/git/refs{/sha}","trees_url":"https://api.github.com/repos/stampit-org/stampit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stampit-org/stampit/statuses/{sha}","languages_url":"https://api.github.com/repos/stampit-org/stampit/languages","stargazers_url":"https://api.github.com/repos/stampit-org/stampit/stargazers","contributors_url":"https://api.github.com/repos/stampit-org/stampit/contributors","subscribers_url":"https://api.github.com/repos/stampit-org/stampit/subscribers","subscription_url":"https://api.github.com/repos/stampit-org/stampit/subscription","commits_url":"https://api.github.com/repos/stampit-org/stampit/commits{/sha}","git_commits_url":"https://api.github.com/repos/stampit-org/stampit/git/commits{/sha}","comments_url":"https://api.github.com/repos/stampit-org/stampit/comments{/number}","issue_comment_url":"https://api.github.com/repos/stampit-org/stampit/issues/comments{/number}","contents_url":"https://api.github.com/repos/stampit-org/stampit/contents/{+path}","compare_url":"https://api.github.com/repos/stampit-org/stampit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stampit-org/stampit/merges","archive_url":"https://api.github.com/repos/stampit-org/stampit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stampit-org/stampit/downloads","issues_url":"https://api.github.com/repos/stampit-org/stampit/issues{/number}","pulls_url":"https://api.github.com/repos/stampit-org/stampit/pulls{/number}","milestones_url":"https://api.github.com/repos/stampit-org/stampit/milestones{/number}","notifications_url":"https://api.github.com/repos/stampit-org/stampit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stampit-org/stampit/labels{/name}","releases_url":"https://api.github.com/repos/stampit-org/stampit/releases{/id}","created_at":"2013-02-10T16:20:49Z","updated_at":"2015-06-27T14:52:21Z","pushed_at":"2015-06-27T15:16:05Z","git_url":"git://github.com/stampit-org/stampit.git","ssh_url":"git@github.com:stampit-org/stampit.git","clone_url":"https://github.com/stampit-org/stampit.git","svn_url":"https://github.com/stampit-org/stampit","homepage":"http://pjabook.com","size":1574,"stargazers_count":959,"watchers_count":959,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":47,"mirror_url":null,"open_issues_count":14,"forks":47,"open_issues":14,"watchers":959,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stampit-org/stampit/pulls/129"},"html":{"href":"https://github.com/stampit-org/stampit/pull/129"},"issue":{"href":"https://api.github.com/repos/stampit-org/stampit/issues/129"},"comments":{"href":"https://api.github.com/repos/stampit-org/stampit/issues/129/comments"},"review_comments":{"href":"https://api.github.com/repos/stampit-org/stampit/pulls/129/comments"},"review_comment":{"href":"https://api.github.com/repos/stampit-org/stampit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stampit-org/stampit/pulls/129/commits"},"statuses":{"href":"https://api.github.com/repos/stampit-org/stampit/statuses/7094d5bbedc713b53fcb04e2c74c19f3b92ccafe"}}}}