{"action":"created","comment":{"url":"https://api.github.com/repos/refractproject/minim/pulls/comments/35570254","id":35570254,"diff_hunk":"@@ -107,8 +111,47 @@ module.exports = function(BaseElement, registry) {\n       return newArray;\n     },\n \n+    /*\n+     * This is a reduce function specifically for Minim arrays and objects. It\n+     * allows for returning normal values or Minim instances, so it converts any\n+     * primitives on each step.\n+     */\n+    reduce: function(fn, givenMemo) {\n+      var startIndex;\n+      var memo;\n+\n+      // Allows for defining a starting value of the reduce\n+      if (!_.isUndefined(givenMemo)) {\n+        startIndex = 0;\n+        memo = registry.toElement(givenMemo);\n+      } else {\n+        startIndex = 1;\n+        // Object Element content items are member elements. Because of this,\n+        // the memo should start out as the member value rather than the\n+        // actual member itself.\n+        memo = this.primitive() === 'object' ? this.first().value : this.first();\n+      }\n+\n+      // Sending each function call to the registry allows for passing Minim\n+      // instances through the function return. This means you can return\n+      // primitive values or return Minim instances and reduce will still work.\n+      for (var i = startIndex; i < this.length; i++) {\n+        var item = this.content[i];\n+\n+        if (this.primitive() === 'object') {\n+          memo = registry.toElement(fn(memo, item.value, item.key, item));\n+        } else {\n+          memo = registry.toElement(fn(memo, item));","path":"lib/primitives/array-element.js","position":45,"original_position":45,"commit_id":"d05b957ef746a1ef27ee62e01dd7e6e62bfbf628","original_commit_id":"d05b957ef746a1ef27ee62e01dd7e6e62bfbf628","user":{"login":"smizell","id":130959,"avatar_url":"https://avatars.githubusercontent.com/u/130959?v=3","gravatar_id":"","url":"https://api.github.com/users/smizell","html_url":"https://github.com/smizell","followers_url":"https://api.github.com/users/smizell/followers","following_url":"https://api.github.com/users/smizell/following{/other_user}","gists_url":"https://api.github.com/users/smizell/gists{/gist_id}","starred_url":"https://api.github.com/users/smizell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smizell/subscriptions","organizations_url":"https://api.github.com/users/smizell/orgs","repos_url":"https://api.github.com/users/smizell/repos","events_url":"https://api.github.com/users/smizell/events{/privacy}","received_events_url":"https://api.github.com/users/smizell/received_events","type":"User","site_admin":false},"body":"That's a good idea, IMO.","created_at":"2015-07-27T18:36:40Z","updated_at":"2015-07-27T18:36:40Z","html_url":"https://github.com/refractproject/minim/pull/67#discussion_r35570254","pull_request_url":"https://api.github.com/repos/refractproject/minim/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/refractproject/minim/pulls/comments/35570254"},"html":{"href":"https://github.com/refractproject/minim/pull/67#discussion_r35570254"},"pull_request":{"href":"https://api.github.com/repos/refractproject/minim/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/refractproject/minim/pulls/67","id":40904050,"html_url":"https://github.com/refractproject/minim/pull/67","diff_url":"https://github.com/refractproject/minim/pull/67.diff","patch_url":"https://github.com/refractproject/minim/pull/67.patch","issue_url":"https://api.github.com/repos/refractproject/minim/issues/67","number":67,"state":"open","locked":false,"title":"Update functional methods","user":{"login":"danielgtaylor","id":106826,"avatar_url":"https://avatars.githubusercontent.com/u/106826?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgtaylor","html_url":"https://github.com/danielgtaylor","followers_url":"https://api.github.com/users/danielgtaylor/followers","following_url":"https://api.github.com/users/danielgtaylor/following{/other_user}","gists_url":"https://api.github.com/users/danielgtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgtaylor/subscriptions","organizations_url":"https://api.github.com/users/danielgtaylor/orgs","repos_url":"https://api.github.com/users/danielgtaylor/repos","events_url":"https://api.github.com/users/danielgtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/danielgtaylor/received_events","type":"User","site_admin":false},"body":"This includes and supersedes #55. It includes the tests from #64. It is required for apiaryio/fury.js#38 Should be ready to merge.\r\n\r\ncc @smizell ","created_at":"2015-07-27T13:40:29Z","updated_at":"2015-07-27T18:36:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96f1d55e6f0ce6f7defacd572d2645a91f01d389","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/refractproject/minim/pulls/67/commits","review_comments_url":"https://api.github.com/repos/refractproject/minim/pulls/67/comments","review_comment_url":"https://api.github.com/repos/refractproject/minim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/refractproject/minim/issues/67/comments","statuses_url":"https://api.github.com/repos/refractproject/minim/statuses/d05b957ef746a1ef27ee62e01dd7e6e62bfbf628","head":{"label":"danielgtaylor:daniel/gh55","ref":"daniel/gh55","sha":"d05b957ef746a1ef27ee62e01dd7e6e62bfbf628","user":{"login":"danielgtaylor","id":106826,"avatar_url":"https://avatars.githubusercontent.com/u/106826?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgtaylor","html_url":"https://github.com/danielgtaylor","followers_url":"https://api.github.com/users/danielgtaylor/followers","following_url":"https://api.github.com/users/danielgtaylor/following{/other_user}","gists_url":"https://api.github.com/users/danielgtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgtaylor/subscriptions","organizations_url":"https://api.github.com/users/danielgtaylor/orgs","repos_url":"https://api.github.com/users/danielgtaylor/repos","events_url":"https://api.github.com/users/danielgtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/danielgtaylor/received_events","type":"User","site_admin":false},"repo":{"id":35580675,"name":"minim","full_name":"danielgtaylor/minim","owner":{"login":"danielgtaylor","id":106826,"avatar_url":"https://avatars.githubusercontent.com/u/106826?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgtaylor","html_url":"https://github.com/danielgtaylor","followers_url":"https://api.github.com/users/danielgtaylor/followers","following_url":"https://api.github.com/users/danielgtaylor/following{/other_user}","gists_url":"https://api.github.com/users/danielgtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgtaylor/subscriptions","organizations_url":"https://api.github.com/users/danielgtaylor/orgs","repos_url":"https://api.github.com/users/danielgtaylor/repos","events_url":"https://api.github.com/users/danielgtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/danielgtaylor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danielgtaylor/minim","description":"A library for interacting with Refract elements","fork":true,"url":"https://api.github.com/repos/danielgtaylor/minim","forks_url":"https://api.github.com/repos/danielgtaylor/minim/forks","keys_url":"https://api.github.com/repos/danielgtaylor/minim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danielgtaylor/minim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danielgtaylor/minim/teams","hooks_url":"https://api.github.com/repos/danielgtaylor/minim/hooks","issue_events_url":"https://api.github.com/repos/danielgtaylor/minim/issues/events{/number}","events_url":"https://api.github.com/repos/danielgtaylor/minim/events","assignees_url":"https://api.github.com/repos/danielgtaylor/minim/assignees{/user}","branches_url":"https://api.github.com/repos/danielgtaylor/minim/branches{/branch}","tags_url":"https://api.github.com/repos/danielgtaylor/minim/tags","blobs_url":"https://api.github.com/repos/danielgtaylor/minim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danielgtaylor/minim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danielgtaylor/minim/git/refs{/sha}","trees_url":"https://api.github.com/repos/danielgtaylor/minim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danielgtaylor/minim/statuses/{sha}","languages_url":"https://api.github.com/repos/danielgtaylor/minim/languages","stargazers_url":"https://api.github.com/repos/danielgtaylor/minim/stargazers","contributors_url":"https://api.github.com/repos/danielgtaylor/minim/contributors","subscribers_url":"https://api.github.com/repos/danielgtaylor/minim/subscribers","subscription_url":"https://api.github.com/repos/danielgtaylor/minim/subscription","commits_url":"https://api.github.com/repos/danielgtaylor/minim/commits{/sha}","git_commits_url":"https://api.github.com/repos/danielgtaylor/minim/git/commits{/sha}","comments_url":"https://api.github.com/repos/danielgtaylor/minim/comments{/number}","issue_comment_url":"https://api.github.com/repos/danielgtaylor/minim/issues/comments{/number}","contents_url":"https://api.github.com/repos/danielgtaylor/minim/contents/{+path}","compare_url":"https://api.github.com/repos/danielgtaylor/minim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danielgtaylor/minim/merges","archive_url":"https://api.github.com/repos/danielgtaylor/minim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danielgtaylor/minim/downloads","issues_url":"https://api.github.com/repos/danielgtaylor/minim/issues{/number}","pulls_url":"https://api.github.com/repos/danielgtaylor/minim/pulls{/number}","milestones_url":"https://api.github.com/repos/danielgtaylor/minim/milestones{/number}","notifications_url":"https://api.github.com/repos/danielgtaylor/minim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danielgtaylor/minim/labels{/name}","releases_url":"https://api.github.com/repos/danielgtaylor/minim/releases{/id}","created_at":"2015-05-14T00:05:04Z","updated_at":"2015-05-14T00:05:31Z","pushed_at":"2015-07-27T13:38:14Z","git_url":"git://github.com/danielgtaylor/minim.git","ssh_url":"git@github.com:danielgtaylor/minim.git","clone_url":"https://github.com/danielgtaylor/minim.git","svn_url":"https://github.com/danielgtaylor/minim","homepage":"","size":250,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"refractproject:master","ref":"master","sha":"f7fa118444875f09cb03fa1d958a1323872ac50b","user":{"login":"refractproject","id":10877387,"avatar_url":"https://avatars.githubusercontent.com/u/10877387?v=3","gravatar_id":"","url":"https://api.github.com/users/refractproject","html_url":"https://github.com/refractproject","followers_url":"https://api.github.com/users/refractproject/followers","following_url":"https://api.github.com/users/refractproject/following{/other_user}","gists_url":"https://api.github.com/users/refractproject/gists{/gist_id}","starred_url":"https://api.github.com/users/refractproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/refractproject/subscriptions","organizations_url":"https://api.github.com/users/refractproject/orgs","repos_url":"https://api.github.com/users/refractproject/repos","events_url":"https://api.github.com/users/refractproject/events{/privacy}","received_events_url":"https://api.github.com/users/refractproject/received_events","type":"Organization","site_admin":false},"repo":{"id":29806257,"name":"minim","full_name":"refractproject/minim","owner":{"login":"refractproject","id":10877387,"avatar_url":"https://avatars.githubusercontent.com/u/10877387?v=3","gravatar_id":"","url":"https://api.github.com/users/refractproject","html_url":"https://github.com/refractproject","followers_url":"https://api.github.com/users/refractproject/followers","following_url":"https://api.github.com/users/refractproject/following{/other_user}","gists_url":"https://api.github.com/users/refractproject/gists{/gist_id}","starred_url":"https://api.github.com/users/refractproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/refractproject/subscriptions","organizations_url":"https://api.github.com/users/refractproject/orgs","repos_url":"https://api.github.com/users/refractproject/repos","events_url":"https://api.github.com/users/refractproject/events{/privacy}","received_events_url":"https://api.github.com/users/refractproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/refractproject/minim","description":"A library for interacting with Refract elements","fork":false,"url":"https://api.github.com/repos/refractproject/minim","forks_url":"https://api.github.com/repos/refractproject/minim/forks","keys_url":"https://api.github.com/repos/refractproject/minim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/refractproject/minim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/refractproject/minim/teams","hooks_url":"https://api.github.com/repos/refractproject/minim/hooks","issue_events_url":"https://api.github.com/repos/refractproject/minim/issues/events{/number}","events_url":"https://api.github.com/repos/refractproject/minim/events","assignees_url":"https://api.github.com/repos/refractproject/minim/assignees{/user}","branches_url":"https://api.github.com/repos/refractproject/minim/branches{/branch}","tags_url":"https://api.github.com/repos/refractproject/minim/tags","blobs_url":"https://api.github.com/repos/refractproject/minim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/refractproject/minim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/refractproject/minim/git/refs{/sha}","trees_url":"https://api.github.com/repos/refractproject/minim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/refractproject/minim/statuses/{sha}","languages_url":"https://api.github.com/repos/refractproject/minim/languages","stargazers_url":"https://api.github.com/repos/refractproject/minim/stargazers","contributors_url":"https://api.github.com/repos/refractproject/minim/contributors","subscribers_url":"https://api.github.com/repos/refractproject/minim/subscribers","subscription_url":"https://api.github.com/repos/refractproject/minim/subscription","commits_url":"https://api.github.com/repos/refractproject/minim/commits{/sha}","git_commits_url":"https://api.github.com/repos/refractproject/minim/git/commits{/sha}","comments_url":"https://api.github.com/repos/refractproject/minim/comments{/number}","issue_comment_url":"https://api.github.com/repos/refractproject/minim/issues/comments{/number}","contents_url":"https://api.github.com/repos/refractproject/minim/contents/{+path}","compare_url":"https://api.github.com/repos/refractproject/minim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/refractproject/minim/merges","archive_url":"https://api.github.com/repos/refractproject/minim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/refractproject/minim/downloads","issues_url":"https://api.github.com/repos/refractproject/minim/issues{/number}","pulls_url":"https://api.github.com/repos/refractproject/minim/pulls{/number}","milestones_url":"https://api.github.com/repos/refractproject/minim/milestones{/number}","notifications_url":"https://api.github.com/repos/refractproject/minim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/refractproject/minim/labels{/name}","releases_url":"https://api.github.com/repos/refractproject/minim/releases{/id}","created_at":"2015-01-25T07:12:23Z","updated_at":"2015-05-25T11:23:16Z","pushed_at":"2015-07-27T13:40:29Z","git_url":"git://github.com/refractproject/minim.git","ssh_url":"git@github.com:refractproject/minim.git","clone_url":"https://github.com/refractproject/minim.git","svn_url":"https://github.com/refractproject/minim","homepage":"","size":736,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":21,"forks":1,"open_issues":21,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/refractproject/minim/pulls/67"},"html":{"href":"https://github.com/refractproject/minim/pull/67"},"issue":{"href":"https://api.github.com/repos/refractproject/minim/issues/67"},"comments":{"href":"https://api.github.com/repos/refractproject/minim/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/refractproject/minim/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/refractproject/minim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/refractproject/minim/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/refractproject/minim/statuses/d05b957ef746a1ef27ee62e01dd7e6e62bfbf628"}}}}