{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/comments/43576099","id":43576099,"diff_hunk":"@@ -1,4 +1,148 @@\n 'use strict';\n+var MAXIMAL_DEPTH = 20;\n+module.exports.get = function (collection, nameStart, maxDepth) {\n+    var currentIndexFriend = 0;\n+    if (maxDepth == undefined) {\n+        maxDepth = MAXIMAL_DEPTH;\n+    }\n+    var isCorrectCollection = true;\n+    if (collection[nameStart] == undefined) {\n+        isCorrectCollection = false;\n+    } else {\n+        var friends = initFriends(collection, nameStart, maxDepth);\n+    }\n+    return {\n+        next: function () {\n+            if (!isCorrectCollection) {\n+                return null;\n+            }\n+            var resultObject;\n+            if (!arguments[0]) {\n+                currentIndexFriend += 1;\n+                if (currentIndexFriend >= friends.length) {\n+                    currentIndexFriend -= 1;\n+                    return null;\n+                }\n+                resultObject = {\n+                    name: friends[currentIndexFriend].name,\n+                    phone: collection[friends[currentIndexFriend].name].phone\n+                };\n+                return resultObject;\n+            } else {\n+                var newIndex = -1;\n+                for (var i = 0; i < friends.length; i++) {\n+                    if (friends[i].name === arguments[0]) {\n+                        newIndex = i;\n+                    }\n+                }\n+                if (newIndex == -1) {\n+                    return null;\n+                } else {\n+                    currentIndexFriend = newIndex;\n+                    resultObject = {\n+                        name: friends[currentIndexFriend].name,\n+                        phone: collection[friends[currentIndexFriend].name].phone\n+                    };\n+                    return resultObject;\n+                }\n+            }\n+        },\n \n-module.exports.get = function (collection, startPoint, depth) {\n+        prev: function () {\n+            if (!isCorrectCollection) {\n+                return null;\n+            }\n+            var resultObject;\n+            if (!arguments[0]) {\n+                currentIndexFriend -= 1;","path":"iterator.js","position":58,"original_position":58,"commit_id":"9f99b8510e96c6d063f2d9ee2016c4b8f511020c","original_commit_id":"9f99b8510e96c6d063f2d9ee2016c4b8f511020c","user":{"login":"vaseker","id":1942271,"avatar_url":"https://avatars.githubusercontent.com/u/1942271?v=3","gravatar_id":"","url":"https://api.github.com/users/vaseker","html_url":"https://github.com/vaseker","followers_url":"https://api.github.com/users/vaseker/followers","following_url":"https://api.github.com/users/vaseker/following{/other_user}","gists_url":"https://api.github.com/users/vaseker/gists{/gist_id}","starred_url":"https://api.github.com/users/vaseker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vaseker/subscriptions","organizations_url":"https://api.github.com/users/vaseker/orgs","repos_url":"https://api.github.com/users/vaseker/repos","events_url":"https://api.github.com/users/vaseker/events{/privacy}","received_events_url":"https://api.github.com/users/vaseker/received_events","type":"User","site_admin":false},"body":"```js\r\n--index;\r\n```","created_at":"2015-10-31T20:56:16Z","updated_at":"2015-10-31T20:56:16Z","html_url":"https://github.com/urfu-2015/javascript-tasks-4/pull/25#discussion_r43576099","pull_request_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/comments/43576099"},"html":{"href":"https://github.com/urfu-2015/javascript-tasks-4/pull/25#discussion_r43576099"},"pull_request":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/25","id":48728539,"html_url":"https://github.com/urfu-2015/javascript-tasks-4/pull/25","diff_url":"https://github.com/urfu-2015/javascript-tasks-4/pull/25.diff","patch_url":"https://github.com/urfu-2015/javascript-tasks-4/pull/25.patch","issue_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/issues/25","number":25,"state":"open","locked":false,"title":"Исаков Федор","user":{"login":"FrodoTheTrue","id":9107905,"avatar_url":"https://avatars.githubusercontent.com/u/9107905?v=3","gravatar_id":"","url":"https://api.github.com/users/FrodoTheTrue","html_url":"https://github.com/FrodoTheTrue","followers_url":"https://api.github.com/users/FrodoTheTrue/followers","following_url":"https://api.github.com/users/FrodoTheTrue/following{/other_user}","gists_url":"https://api.github.com/users/FrodoTheTrue/gists{/gist_id}","starred_url":"https://api.github.com/users/FrodoTheTrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrodoTheTrue/subscriptions","organizations_url":"https://api.github.com/users/FrodoTheTrue/orgs","repos_url":"https://api.github.com/users/FrodoTheTrue/repos","events_url":"https://api.github.com/users/FrodoTheTrue/events{/privacy}","received_events_url":"https://api.github.com/users/FrodoTheTrue/received_events","type":"User","site_admin":false},"body":"feat(iterator): base code","created_at":"2015-10-26T11:36:58Z","updated_at":"2015-10-31T20:56:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd46400e01a09a9b9b08f2ecbae6542681788685","assignee":{"login":"vaseker","id":1942271,"avatar_url":"https://avatars.githubusercontent.com/u/1942271?v=3","gravatar_id":"","url":"https://api.github.com/users/vaseker","html_url":"https://github.com/vaseker","followers_url":"https://api.github.com/users/vaseker/followers","following_url":"https://api.github.com/users/vaseker/following{/other_user}","gists_url":"https://api.github.com/users/vaseker/gists{/gist_id}","starred_url":"https://api.github.com/users/vaseker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vaseker/subscriptions","organizations_url":"https://api.github.com/users/vaseker/orgs","repos_url":"https://api.github.com/users/vaseker/repos","events_url":"https://api.github.com/users/vaseker/events{/privacy}","received_events_url":"https://api.github.com/users/vaseker/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/25/commits","review_comments_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/25/comments","review_comment_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/issues/25/comments","statuses_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/statuses/9f99b8510e96c6d063f2d9ee2016c4b8f511020c","head":{"label":"FrodoTheTrue:master","ref":"master","sha":"9f99b8510e96c6d063f2d9ee2016c4b8f511020c","user":{"login":"FrodoTheTrue","id":9107905,"avatar_url":"https://avatars.githubusercontent.com/u/9107905?v=3","gravatar_id":"","url":"https://api.github.com/users/FrodoTheTrue","html_url":"https://github.com/FrodoTheTrue","followers_url":"https://api.github.com/users/FrodoTheTrue/followers","following_url":"https://api.github.com/users/FrodoTheTrue/following{/other_user}","gists_url":"https://api.github.com/users/FrodoTheTrue/gists{/gist_id}","starred_url":"https://api.github.com/users/FrodoTheTrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrodoTheTrue/subscriptions","organizations_url":"https://api.github.com/users/FrodoTheTrue/orgs","repos_url":"https://api.github.com/users/FrodoTheTrue/repos","events_url":"https://api.github.com/users/FrodoTheTrue/events{/privacy}","received_events_url":"https://api.github.com/users/FrodoTheTrue/received_events","type":"User","site_admin":false},"repo":{"id":44862060,"name":"javascript-tasks-4","full_name":"FrodoTheTrue/javascript-tasks-4","owner":{"login":"FrodoTheTrue","id":9107905,"avatar_url":"https://avatars.githubusercontent.com/u/9107905?v=3","gravatar_id":"","url":"https://api.github.com/users/FrodoTheTrue","html_url":"https://github.com/FrodoTheTrue","followers_url":"https://api.github.com/users/FrodoTheTrue/followers","following_url":"https://api.github.com/users/FrodoTheTrue/following{/other_user}","gists_url":"https://api.github.com/users/FrodoTheTrue/gists{/gist_id}","starred_url":"https://api.github.com/users/FrodoTheTrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrodoTheTrue/subscriptions","organizations_url":"https://api.github.com/users/FrodoTheTrue/orgs","repos_url":"https://api.github.com/users/FrodoTheTrue/repos","events_url":"https://api.github.com/users/FrodoTheTrue/events{/privacy}","received_events_url":"https://api.github.com/users/FrodoTheTrue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/FrodoTheTrue/javascript-tasks-4","description":"Задача к лекции «Замыкания в Javascript» – «Мальчишник в Вегасе»","fork":true,"url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4","forks_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/forks","keys_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/teams","hooks_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/hooks","issue_events_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/issues/events{/number}","events_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/events","assignees_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/assignees{/user}","branches_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/branches{/branch}","tags_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/tags","blobs_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/git/refs{/sha}","trees_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/statuses/{sha}","languages_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/languages","stargazers_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/stargazers","contributors_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/contributors","subscribers_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/subscribers","subscription_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/subscription","commits_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/commits{/sha}","git_commits_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/git/commits{/sha}","comments_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/comments{/number}","issue_comment_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/issues/comments{/number}","contents_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/contents/{+path}","compare_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/merges","archive_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/downloads","issues_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/issues{/number}","pulls_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/pulls{/number}","milestones_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/milestones{/number}","notifications_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/labels{/name}","releases_url":"https://api.github.com/repos/FrodoTheTrue/javascript-tasks-4/releases{/id}","created_at":"2015-10-24T10:47:00Z","updated_at":"2015-10-24T10:47:02Z","pushed_at":"2015-10-31T13:59:47Z","git_url":"git://github.com/FrodoTheTrue/javascript-tasks-4.git","ssh_url":"git@github.com:FrodoTheTrue/javascript-tasks-4.git","clone_url":"https://github.com/FrodoTheTrue/javascript-tasks-4.git","svn_url":"https://github.com/FrodoTheTrue/javascript-tasks-4","homepage":"","size":101,"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":"urfu-2015:master","ref":"master","sha":"6a66099e0cce3103fea6749633962c0f8ba1b74f","user":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"repo":{"id":44542271,"name":"javascript-tasks-4","full_name":"urfu-2015/javascript-tasks-4","owner":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urfu-2015/javascript-tasks-4","description":"Задача к лекции «Замыкания в Javascript» – «Мальчишник в Вегасе»","fork":false,"url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4","forks_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/forks","keys_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/teams","hooks_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/hooks","issue_events_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/events","assignees_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/tags","blobs_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/languages","stargazers_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/stargazers","contributors_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/contributors","subscribers_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/subscribers","subscription_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/subscription","commits_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/merges","archive_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/downloads","issues_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/releases{/id}","created_at":"2015-10-19T14:57:11Z","updated_at":"2015-10-20T18:57:43Z","pushed_at":"2015-10-31T19:44:36Z","git_url":"git://github.com/urfu-2015/javascript-tasks-4.git","ssh_url":"git@github.com:urfu-2015/javascript-tasks-4.git","clone_url":"https://github.com/urfu-2015/javascript-tasks-4.git","svn_url":"https://github.com/urfu-2015/javascript-tasks-4","homepage":"","size":1471,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":62,"mirror_url":null,"open_issues_count":39,"forks":62,"open_issues":39,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/25"},"html":{"href":"https://github.com/urfu-2015/javascript-tasks-4/pull/25"},"issue":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/issues/25"},"comments":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-4/statuses/9f99b8510e96c6d063f2d9ee2016c4b8f511020c"}}}}