{"action":"created","comment":{"url":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/comments/72103408","id":72103408,"diff_hunk":"@@ -69,40 +121,50 @@ function createStamp(descriptor, composeFunction) {\n  * @returns {object} Returns the dstDescriptor argument.\n  */\n function mergeComposable(dstDescriptor, srcComposable) {\n-  const srcDescriptor = (srcComposable && srcComposable.compose) || srcComposable;\n+  // Check if it's a stamp or something else.\n+  const srcDescriptor = isStamp(srcComposable) ? srcComposable.compose : srcComposable;\n+  // Ignore everything but things we can merge.\n   if (!isDescriptor(srcDescriptor)) return dstDescriptor;\n \n   const combineProperty = (propName, action) => {\n-    if (!isObject(srcDescriptor[propName])) return;\n-    if (!isObject(dstDescriptor[propName])) dstDescriptor[propName] = {};\n+    // Do not create destination properties if there is no need.\n+    if (!isDescriptor(srcDescriptor[propName])) return;\n+    // Check if the destination is malformed, fix the problem if any.\n+    if (!isDescriptor(dstDescriptor[propName])) dstDescriptor[propName] = {};\n+    // Deep merge or shallow assign objects.\n     action(dstDescriptor[propName], srcDescriptor[propName]);\n   };\n \n   combineProperty('methods', assign);\n   combineProperty('properties', assign);\n-  combineProperty('deepProperties', merge);\n+  combineProperty('deepProperties', mergeDescriptor);\n   combineProperty('propertyDescriptors', assign);\n   combineProperty('staticProperties', assign);\n-  combineProperty('staticDeepProperties', merge);\n+  combineProperty('staticDeepProperties', mergeDescriptor);\n   combineProperty('staticPropertyDescriptors', assign);\n   combineProperty('configuration', assign);\n-  combineProperty('deepConfiguration', merge);\n-  if (Array.isArray(srcDescriptor.initializers)) {\n-    const initializers = (dstDescriptor.initializers || [])\n-      .concat(srcDescriptor.initializers)\n-      .filter(isFunction);\n-    dstDescriptor.initializers = uniq(initializers);\n+  combineProperty('deepConfiguration', mergeDescriptor);\n+\n+  if (isArray(srcDescriptor.initializers)) {\n+    // Initializers must be concatenated. '.concat' will also create a new array instance.\n+    const dstInitializers = (dstDescriptor.initializers || []).concat(srcDescriptor.initializers);\n+    // The resulting initializers array must contain function only, and\n+    // must not have duplicate initializers - the first occurrence wins.\n+    dstDescriptor.initializers = uniq(dstInitializers.filter(isFunction));\n   }\n \n   return dstDescriptor;\n }\n \n /**\n- * Given the list of composables (stamp descriptors and stamps) returns a new stamp (composable factory function).\n+ * Given the list of composables (stamp descriptors and stamps)\n+ * returns a new stamp (composable factory function).","path":"compose.js","position":170,"original_position":170,"commit_id":"4419aa5417bb2939a8842492a6f2f97229ae7822","original_commit_id":"4419aa5417bb2939a8842492a6f2f97229ae7822","user":{"login":"boneskull","id":924465,"avatar_url":"https://avatars.githubusercontent.com/u/924465?v=3","gravatar_id":"","url":"https://api.github.com/users/boneskull","html_url":"https://github.com/boneskull","followers_url":"https://api.github.com/users/boneskull/followers","following_url":"https://api.github.com/users/boneskull/following{/other_user}","gists_url":"https://api.github.com/users/boneskull/gists{/gist_id}","starred_url":"https://api.github.com/users/boneskull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boneskull/subscriptions","organizations_url":"https://api.github.com/users/boneskull/orgs","repos_url":"https://api.github.com/users/boneskull/repos","events_url":"https://api.github.com/users/boneskull/events{/privacy}","received_events_url":"https://api.github.com/users/boneskull/received_events","type":"User","site_admin":false},"body":"If you can make a `@typedef` that defines a Stamp, I'll buy you a beer.","created_at":"2016-07-25T17:06:28Z","updated_at":"2016-07-25T17:06:28Z","html_url":"https://github.com/stampit-org/stamp-specification/pull/105#discussion_r72103408","pull_request_url":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/105","_links":{"self":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/comments/72103408"},"html":{"href":"https://github.com/stampit-org/stamp-specification/pull/105#discussion_r72103408"},"pull_request":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/105"}}},"pull_request":{"url":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/105","id":78679147,"html_url":"https://github.com/stampit-org/stamp-specification/pull/105","diff_url":"https://github.com/stampit-org/stamp-specification/pull/105.diff","patch_url":"https://github.com/stampit-org/stamp-specification/pull/105.patch","issue_url":"https://api.github.com/repos/stampit-org/stamp-specification/issues/105","number":105,"state":"open","locked":false,"title":"New merge algorithm","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":"The PR looks large, although there is only one actual change - the new merging algorithm. It implements #101 \r\n\r\nMinor changes:\r\n* update linting\r\n* add plentiful of comments. Closes #65 at last\r\n* Uses new `check-compose` to test the algorithm","created_at":"2016-07-25T13:16:44Z","updated_at":"2016-07-25T17:06:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62c84301f492195ca93d59eefc16e219eee70f92","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/105/commits","review_comments_url":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/105/comments","review_comment_url":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stampit-org/stamp-specification/issues/105/comments","statuses_url":"https://api.github.com/repos/stampit-org/stamp-specification/statuses/4419aa5417bb2939a8842492a6f2f97229ae7822","head":{"label":"stampit-org:new-merge-algorithm","ref":"new-merge-algorithm","sha":"4419aa5417bb2939a8842492a6f2f97229ae7822","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":38865095,"name":"stamp-specification","full_name":"stampit-org/stamp-specification","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/stamp-specification","description":"The Stamp Specification: Composables","fork":false,"url":"https://api.github.com/repos/stampit-org/stamp-specification","forks_url":"https://api.github.com/repos/stampit-org/stamp-specification/forks","keys_url":"https://api.github.com/repos/stampit-org/stamp-specification/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stampit-org/stamp-specification/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stampit-org/stamp-specification/teams","hooks_url":"https://api.github.com/repos/stampit-org/stamp-specification/hooks","issue_events_url":"https://api.github.com/repos/stampit-org/stamp-specification/issues/events{/number}","events_url":"https://api.github.com/repos/stampit-org/stamp-specification/events","assignees_url":"https://api.github.com/repos/stampit-org/stamp-specification/assignees{/user}","branches_url":"https://api.github.com/repos/stampit-org/stamp-specification/branches{/branch}","tags_url":"https://api.github.com/repos/stampit-org/stamp-specification/tags","blobs_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/refs{/sha}","trees_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stampit-org/stamp-specification/statuses/{sha}","languages_url":"https://api.github.com/repos/stampit-org/stamp-specification/languages","stargazers_url":"https://api.github.com/repos/stampit-org/stamp-specification/stargazers","contributors_url":"https://api.github.com/repos/stampit-org/stamp-specification/contributors","subscribers_url":"https://api.github.com/repos/stampit-org/stamp-specification/subscribers","subscription_url":"https://api.github.com/repos/stampit-org/stamp-specification/subscription","commits_url":"https://api.github.com/repos/stampit-org/stamp-specification/commits{/sha}","git_commits_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/commits{/sha}","comments_url":"https://api.github.com/repos/stampit-org/stamp-specification/comments{/number}","issue_comment_url":"https://api.github.com/repos/stampit-org/stamp-specification/issues/comments{/number}","contents_url":"https://api.github.com/repos/stampit-org/stamp-specification/contents/{+path}","compare_url":"https://api.github.com/repos/stampit-org/stamp-specification/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stampit-org/stamp-specification/merges","archive_url":"https://api.github.com/repos/stampit-org/stamp-specification/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stampit-org/stamp-specification/downloads","issues_url":"https://api.github.com/repos/stampit-org/stamp-specification/issues{/number}","pulls_url":"https://api.github.com/repos/stampit-org/stamp-specification/pulls{/number}","milestones_url":"https://api.github.com/repos/stampit-org/stamp-specification/milestones{/number}","notifications_url":"https://api.github.com/repos/stampit-org/stamp-specification/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stampit-org/stamp-specification/labels{/name}","releases_url":"https://api.github.com/repos/stampit-org/stamp-specification/releases{/id}","deployments_url":"https://api.github.com/repos/stampit-org/stamp-specification/deployments","created_at":"2015-07-10T06:33:55Z","updated_at":"2016-07-24T04:47:28Z","pushed_at":"2016-07-25T13:16:45Z","git_url":"git://github.com/stampit-org/stamp-specification.git","ssh_url":"git@github.com:stampit-org/stamp-specification.git","clone_url":"https://github.com/stampit-org/stamp-specification.git","svn_url":"https://github.com/stampit-org/stamp-specification","homepage":"","size":153,"stargazers_count":194,"watchers_count":194,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":6,"forks":8,"open_issues":6,"watchers":194,"default_branch":"master"}},"base":{"label":"stampit-org:master","ref":"master","sha":"5aae772f2f881deaf2fcb7fdc48ca957e2fb7709","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":38865095,"name":"stamp-specification","full_name":"stampit-org/stamp-specification","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/stamp-specification","description":"The Stamp Specification: Composables","fork":false,"url":"https://api.github.com/repos/stampit-org/stamp-specification","forks_url":"https://api.github.com/repos/stampit-org/stamp-specification/forks","keys_url":"https://api.github.com/repos/stampit-org/stamp-specification/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stampit-org/stamp-specification/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stampit-org/stamp-specification/teams","hooks_url":"https://api.github.com/repos/stampit-org/stamp-specification/hooks","issue_events_url":"https://api.github.com/repos/stampit-org/stamp-specification/issues/events{/number}","events_url":"https://api.github.com/repos/stampit-org/stamp-specification/events","assignees_url":"https://api.github.com/repos/stampit-org/stamp-specification/assignees{/user}","branches_url":"https://api.github.com/repos/stampit-org/stamp-specification/branches{/branch}","tags_url":"https://api.github.com/repos/stampit-org/stamp-specification/tags","blobs_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/refs{/sha}","trees_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stampit-org/stamp-specification/statuses/{sha}","languages_url":"https://api.github.com/repos/stampit-org/stamp-specification/languages","stargazers_url":"https://api.github.com/repos/stampit-org/stamp-specification/stargazers","contributors_url":"https://api.github.com/repos/stampit-org/stamp-specification/contributors","subscribers_url":"https://api.github.com/repos/stampit-org/stamp-specification/subscribers","subscription_url":"https://api.github.com/repos/stampit-org/stamp-specification/subscription","commits_url":"https://api.github.com/repos/stampit-org/stamp-specification/commits{/sha}","git_commits_url":"https://api.github.com/repos/stampit-org/stamp-specification/git/commits{/sha}","comments_url":"https://api.github.com/repos/stampit-org/stamp-specification/comments{/number}","issue_comment_url":"https://api.github.com/repos/stampit-org/stamp-specification/issues/comments{/number}","contents_url":"https://api.github.com/repos/stampit-org/stamp-specification/contents/{+path}","compare_url":"https://api.github.com/repos/stampit-org/stamp-specification/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stampit-org/stamp-specification/merges","archive_url":"https://api.github.com/repos/stampit-org/stamp-specification/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stampit-org/stamp-specification/downloads","issues_url":"https://api.github.com/repos/stampit-org/stamp-specification/issues{/number}","pulls_url":"https://api.github.com/repos/stampit-org/stamp-specification/pulls{/number}","milestones_url":"https://api.github.com/repos/stampit-org/stamp-specification/milestones{/number}","notifications_url":"https://api.github.com/repos/stampit-org/stamp-specification/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stampit-org/stamp-specification/labels{/name}","releases_url":"https://api.github.com/repos/stampit-org/stamp-specification/releases{/id}","deployments_url":"https://api.github.com/repos/stampit-org/stamp-specification/deployments","created_at":"2015-07-10T06:33:55Z","updated_at":"2016-07-24T04:47:28Z","pushed_at":"2016-07-25T13:16:45Z","git_url":"git://github.com/stampit-org/stamp-specification.git","ssh_url":"git@github.com:stampit-org/stamp-specification.git","clone_url":"https://github.com/stampit-org/stamp-specification.git","svn_url":"https://github.com/stampit-org/stamp-specification","homepage":"","size":153,"stargazers_count":194,"watchers_count":194,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":6,"forks":8,"open_issues":6,"watchers":194,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/105"},"html":{"href":"https://github.com/stampit-org/stamp-specification/pull/105"},"issue":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/issues/105"},"comments":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/stampit-org/stamp-specification/statuses/4419aa5417bb2939a8842492a6f2f97229ae7822"}}}}
{"actor":{"display_login":"boneskull"}}