{"action":"created","comment":{"url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/comments/100402993","pull_request_review_id":21109459,"id":100402993,"diff_hunk":"@@ -0,0 +1,26 @@\n+export default function closestPair(points) {\n+\n+  let lowestDistance = pythagorean(points[0], points[1])\n+  let closestPoints = []\n+\n+  for (let i = 0; i < points.length; i++) {\n+    for (let j = 0; j < points.length; j++) {\n+      if(points[i] !== points[j] && pythagorean(points[i], points[j]) < lowestDistance) {\n+        lowestDistance = pythagorean(points[i], points[j])\n+        closestPoints[0] = points[i]\n+        closestPoints[1] = points[j]\n+      }\n+    }\n+  }\n+  return {\n+    pair: closestPoints,\n+    distance: lowestDistance\n+  }\n+}\n+\n+function pythagorean(startPoint, endPoint) {","path":"src/closestPair.js","position":21,"original_position":21,"commit_id":"5079faa4d59078054b616c61193a39f20c8d73e0","original_commit_id":"5079faa4d59078054b616c61193a39f20c8d73e0","user":{"login":"deadlyicon","id":8385,"avatar_url":"https://avatars.githubusercontent.com/u/8385?v=3","gravatar_id":"","url":"https://api.github.com/users/deadlyicon","html_url":"https://github.com/deadlyicon","followers_url":"https://api.github.com/users/deadlyicon/followers","following_url":"https://api.github.com/users/deadlyicon/following{/other_user}","gists_url":"https://api.github.com/users/deadlyicon/gists{/gist_id}","starred_url":"https://api.github.com/users/deadlyicon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deadlyicon/subscriptions","organizations_url":"https://api.github.com/users/deadlyicon/orgs","repos_url":"https://api.github.com/users/deadlyicon/repos","events_url":"https://api.github.com/users/deadlyicon/events{/privacy}","received_events_url":"https://api.github.com/users/deadlyicon/received_events","type":"User","site_admin":false},"body":"you could dry up the duplication in this function like this:\r\n\r\n```js\r\nfunction pythagorean(startPoint, endPoint) {\r\n  return Math.sqrt(\r\n    something(startPoint[0], endPoint[0]),\r\n    something(startPoint[1], endPoint[1]),\r\n  )\r\n}\r\n\r\nfunction something(pointA, pointB){\r\n  return Math.pow(Math.abs(pointA - pointB), 2)\r\n}\r\n```","created_at":"2017-02-09T20:23:08Z","updated_at":"2017-02-09T20:29:49Z","html_url":"https://github.com/TrevorJamesH/core-algorithms/pull/17#discussion_r100402993","pull_request_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/comments/100402993"},"html":{"href":"https://github.com/TrevorJamesH/core-algorithms/pull/17#discussion_r100402993"},"pull_request":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/17","id":105499742,"html_url":"https://github.com/TrevorJamesH/core-algorithms/pull/17","diff_url":"https://github.com/TrevorJamesH/core-algorithms/pull/17.diff","patch_url":"https://github.com/TrevorJamesH/core-algorithms/pull/17.patch","issue_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues/17","number":17,"state":"open","locked":false,"title":"finishes closest pair and adds some testing","user":{"login":"lizzkats","id":2946336,"avatar_url":"https://avatars.githubusercontent.com/u/2946336?v=3","gravatar_id":"","url":"https://api.github.com/users/lizzkats","html_url":"https://github.com/lizzkats","followers_url":"https://api.github.com/users/lizzkats/followers","following_url":"https://api.github.com/users/lizzkats/following{/other_user}","gists_url":"https://api.github.com/users/lizzkats/gists{/gist_id}","starred_url":"https://api.github.com/users/lizzkats/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lizzkats/subscriptions","organizations_url":"https://api.github.com/users/lizzkats/orgs","repos_url":"https://api.github.com/users/lizzkats/repos","events_url":"https://api.github.com/users/lizzkats/events{/privacy}","received_events_url":"https://api.github.com/users/lizzkats/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-02-09T19:47:00Z","updated_at":"2017-02-09T20:29:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e614224523681b1e67d93a119cface1bcd4bcf06","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/17/commits","review_comments_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/17/comments","review_comment_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues/17/comments","statuses_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/statuses/5079faa4d59078054b616c61193a39f20c8d73e0","head":{"label":"TrevorJamesH:closestPair","ref":"closestPair","sha":"5079faa4d59078054b616c61193a39f20c8d73e0","user":{"login":"TrevorJamesH","id":20617621,"avatar_url":"https://avatars.githubusercontent.com/u/20617621?v=3","gravatar_id":"","url":"https://api.github.com/users/TrevorJamesH","html_url":"https://github.com/TrevorJamesH","followers_url":"https://api.github.com/users/TrevorJamesH/followers","following_url":"https://api.github.com/users/TrevorJamesH/following{/other_user}","gists_url":"https://api.github.com/users/TrevorJamesH/gists{/gist_id}","starred_url":"https://api.github.com/users/TrevorJamesH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrevorJamesH/subscriptions","organizations_url":"https://api.github.com/users/TrevorJamesH/orgs","repos_url":"https://api.github.com/users/TrevorJamesH/repos","events_url":"https://api.github.com/users/TrevorJamesH/events{/privacy}","received_events_url":"https://api.github.com/users/TrevorJamesH/received_events","type":"User","site_admin":false},"repo":{"id":81122084,"name":"core-algorithms","full_name":"TrevorJamesH/core-algorithms","owner":{"login":"TrevorJamesH","id":20617621,"avatar_url":"https://avatars.githubusercontent.com/u/20617621?v=3","gravatar_id":"","url":"https://api.github.com/users/TrevorJamesH","html_url":"https://github.com/TrevorJamesH","followers_url":"https://api.github.com/users/TrevorJamesH/followers","following_url":"https://api.github.com/users/TrevorJamesH/following{/other_user}","gists_url":"https://api.github.com/users/TrevorJamesH/gists{/gist_id}","starred_url":"https://api.github.com/users/TrevorJamesH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrevorJamesH/subscriptions","organizations_url":"https://api.github.com/users/TrevorJamesH/orgs","repos_url":"https://api.github.com/users/TrevorJamesH/repos","events_url":"https://api.github.com/users/TrevorJamesH/events{/privacy}","received_events_url":"https://api.github.com/users/TrevorJamesH/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TrevorJamesH/core-algorithms","description":"Tests and implementations for algorithms commonly used in job interviews.","fork":true,"url":"https://api.github.com/repos/TrevorJamesH/core-algorithms","forks_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/forks","keys_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/teams","hooks_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/hooks","issue_events_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues/events{/number}","events_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/events","assignees_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/assignees{/user}","branches_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/branches{/branch}","tags_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/tags","blobs_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/refs{/sha}","trees_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/statuses/{sha}","languages_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/languages","stargazers_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/stargazers","contributors_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/contributors","subscribers_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/subscribers","subscription_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/subscription","commits_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/commits{/sha}","git_commits_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/commits{/sha}","comments_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/comments{/number}","issue_comment_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues/comments{/number}","contents_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/contents/{+path}","compare_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/merges","archive_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/downloads","issues_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues{/number}","pulls_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls{/number}","milestones_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/milestones{/number}","notifications_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/labels{/name}","releases_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/releases{/id}","deployments_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/deployments","created_at":"2017-02-06T19:14:18Z","updated_at":"2017-02-06T19:14:20Z","pushed_at":"2017-02-09T19:50:29Z","git_url":"git://github.com/TrevorJamesH/core-algorithms.git","ssh_url":"git@github.com:TrevorJamesH/core-algorithms.git","clone_url":"https://github.com/TrevorJamesH/core-algorithms.git","svn_url":"https://github.com/TrevorJamesH/core-algorithms","homepage":null,"size":33,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"TrevorJamesH:master","ref":"master","sha":"f3805672a36d9103584e4cdfa77045016246c750","user":{"login":"TrevorJamesH","id":20617621,"avatar_url":"https://avatars.githubusercontent.com/u/20617621?v=3","gravatar_id":"","url":"https://api.github.com/users/TrevorJamesH","html_url":"https://github.com/TrevorJamesH","followers_url":"https://api.github.com/users/TrevorJamesH/followers","following_url":"https://api.github.com/users/TrevorJamesH/following{/other_user}","gists_url":"https://api.github.com/users/TrevorJamesH/gists{/gist_id}","starred_url":"https://api.github.com/users/TrevorJamesH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrevorJamesH/subscriptions","organizations_url":"https://api.github.com/users/TrevorJamesH/orgs","repos_url":"https://api.github.com/users/TrevorJamesH/repos","events_url":"https://api.github.com/users/TrevorJamesH/events{/privacy}","received_events_url":"https://api.github.com/users/TrevorJamesH/received_events","type":"User","site_admin":false},"repo":{"id":81122084,"name":"core-algorithms","full_name":"TrevorJamesH/core-algorithms","owner":{"login":"TrevorJamesH","id":20617621,"avatar_url":"https://avatars.githubusercontent.com/u/20617621?v=3","gravatar_id":"","url":"https://api.github.com/users/TrevorJamesH","html_url":"https://github.com/TrevorJamesH","followers_url":"https://api.github.com/users/TrevorJamesH/followers","following_url":"https://api.github.com/users/TrevorJamesH/following{/other_user}","gists_url":"https://api.github.com/users/TrevorJamesH/gists{/gist_id}","starred_url":"https://api.github.com/users/TrevorJamesH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TrevorJamesH/subscriptions","organizations_url":"https://api.github.com/users/TrevorJamesH/orgs","repos_url":"https://api.github.com/users/TrevorJamesH/repos","events_url":"https://api.github.com/users/TrevorJamesH/events{/privacy}","received_events_url":"https://api.github.com/users/TrevorJamesH/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TrevorJamesH/core-algorithms","description":"Tests and implementations for algorithms commonly used in job interviews.","fork":true,"url":"https://api.github.com/repos/TrevorJamesH/core-algorithms","forks_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/forks","keys_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/teams","hooks_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/hooks","issue_events_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues/events{/number}","events_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/events","assignees_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/assignees{/user}","branches_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/branches{/branch}","tags_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/tags","blobs_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/refs{/sha}","trees_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/statuses/{sha}","languages_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/languages","stargazers_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/stargazers","contributors_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/contributors","subscribers_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/subscribers","subscription_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/subscription","commits_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/commits{/sha}","git_commits_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/git/commits{/sha}","comments_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/comments{/number}","issue_comment_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues/comments{/number}","contents_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/contents/{+path}","compare_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/merges","archive_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/downloads","issues_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues{/number}","pulls_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls{/number}","milestones_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/milestones{/number}","notifications_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/labels{/name}","releases_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/releases{/id}","deployments_url":"https://api.github.com/repos/TrevorJamesH/core-algorithms/deployments","created_at":"2017-02-06T19:14:18Z","updated_at":"2017-02-06T19:14:20Z","pushed_at":"2017-02-09T19:50:29Z","git_url":"git://github.com/TrevorJamesH/core-algorithms.git","ssh_url":"git@github.com:TrevorJamesH/core-algorithms.git","clone_url":"https://github.com/TrevorJamesH/core-algorithms.git","svn_url":"https://github.com/TrevorJamesH/core-algorithms","homepage":null,"size":33,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/17"},"html":{"href":"https://github.com/TrevorJamesH/core-algorithms/pull/17"},"issue":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues/17"},"comments":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/TrevorJamesH/core-algorithms/statuses/5079faa4d59078054b616c61193a39f20c8d73e0"}}}}
{"actor":{"display_login":"deadlyicon"}}