{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/comments/86622618","pull_request_review_id":7275207,"id":86622618,"diff_hunk":"@@ -13,58 +13,120 @@ exports.isStar = true;\n  * @returns {Array}\n  */\n exports.query = function (collection) {\n-    return collection;\n+    var args = [].slice.call(arguments);\n+    var copyCollection = JSON.parse(JSON.stringify(collection));\n+\n+    var functions = args.slice(1);\n+    var sortedFunctions = functions.sort(function (a, b) {\n+        return a.name > b.name;\n+    });\n+\n+    for (var i = 0; i < sortedFunctions.length; i++) {\n+        var functionName = sortedFunctions[i];\n+        copyCollection = functionName(copyCollection);\n+    }\n+\n+    return copyCollection;\n };\n \n /**\n  * Выбор полей\n  * @params {...String}\n+ * @returns {Function}\n  */\n exports.select = function () {\n-    return;\n+    var args = [].slice.call(arguments);\n+\n+    return function select(collection) {\n+\n+        return collection.map(function (item) {\n+            for (var key in item) {\n+                if (args.indexOf(key) === -1) {\n+                    delete item[key];\n+                }\n+            }\n+\n+            return item;\n+        });\n+    };\n };\n \n /**\n  * Фильтрация поля по массиву значений\n  * @param {String} property – Свойство для фильтрации\n  * @param {Array} values – Доступные значения\n+ * @returns {Function}\n  */\n exports.filterIn = function (property, values) {\n-    console.info(property, values);\n \n-    return;\n+    return function filterIn(collection) {\n+        return collection.filter(function (item) {\n+            return (values.indexOf(item[property]) !== -1);\n+        });\n+\n+    };\n };\n \n /**\n  * Сортировка коллекции по полю\n  * @param {String} property – Свойство для фильтрации\n  * @param {String} order – Порядок сортировки (asc - по возрастанию; desc – по убыванию)\n+ * @returns {Function}\n  */\n exports.sortBy = function (property, order) {\n-    console.info(property, order);\n \n-    return;\n+    return function (collection) {\n+\n+        var sortedCollection = collection.sort(function (a, b) {\n+            if (a[property] < b[property]) {\n+                return -1;\n+            }\n+            if (a[property] > b[property]) {","path":"lego.js","position":87,"original_position":87,"commit_id":"4cd0f747c8a0cda1b7b5dc16f90113d7551efeea","original_commit_id":"4cd0f747c8a0cda1b7b5dc16f90113d7551efeea","user":{"login":"bazhenova","id":12410663,"avatar_url":"https://avatars.githubusercontent.com/u/12410663?v=3","gravatar_id":"","url":"https://api.github.com/users/bazhenova","html_url":"https://github.com/bazhenova","followers_url":"https://api.github.com/users/bazhenova/followers","following_url":"https://api.github.com/users/bazhenova/following{/other_user}","gists_url":"https://api.github.com/users/bazhenova/gists{/gist_id}","starred_url":"https://api.github.com/users/bazhenova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazhenova/subscriptions","organizations_url":"https://api.github.com/users/bazhenova/orgs","repos_url":"https://api.github.com/users/bazhenova/repos","events_url":"https://api.github.com/users/bazhenova/events{/privacy}","received_events_url":"https://api.github.com/users/bazhenova/received_events","type":"User","site_admin":false},"body":"Вот в этом месте можем записать попроще :) Давай, надо чуть-чуть подумать","created_at":"2016-11-04T20:04:41Z","updated_at":"2016-11-04T20:04:41Z","html_url":"https://github.com/urfu-2016/javascript-task-4/pull/28#discussion_r86622618","pull_request_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/comments/86622618"},"html":{"href":"https://github.com/urfu-2016/javascript-task-4/pull/28#discussion_r86622618"},"pull_request":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/28","id":91817469,"html_url":"https://github.com/urfu-2016/javascript-task-4/pull/28","diff_url":"https://github.com/urfu-2016/javascript-task-4/pull/28.diff","patch_url":"https://github.com/urfu-2016/javascript-task-4/pull/28.patch","issue_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/issues/28","number":28,"state":"open","locked":false,"title":"Трофимов Павел","user":{"login":"tgkd","id":6171708,"avatar_url":"https://avatars.githubusercontent.com/u/6171708?v=3","gravatar_id":"","url":"https://api.github.com/users/tgkd","html_url":"https://github.com/tgkd","followers_url":"https://api.github.com/users/tgkd/followers","following_url":"https://api.github.com/users/tgkd/following{/other_user}","gists_url":"https://api.github.com/users/tgkd/gists{/gist_id}","starred_url":"https://api.github.com/users/tgkd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgkd/subscriptions","organizations_url":"https://api.github.com/users/tgkd/orgs","repos_url":"https://api.github.com/users/tgkd/repos","events_url":"https://api.github.com/users/tgkd/events{/privacy}","received_events_url":"https://api.github.com/users/tgkd/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-01T16:37:22Z","updated_at":"2016-11-04T20:04:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1f8c926561996ad290f88e00ee71e38956a6eaa9","assignee":{"login":"bazhenova","id":12410663,"avatar_url":"https://avatars.githubusercontent.com/u/12410663?v=3","gravatar_id":"","url":"https://api.github.com/users/bazhenova","html_url":"https://github.com/bazhenova","followers_url":"https://api.github.com/users/bazhenova/followers","following_url":"https://api.github.com/users/bazhenova/following{/other_user}","gists_url":"https://api.github.com/users/bazhenova/gists{/gist_id}","starred_url":"https://api.github.com/users/bazhenova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazhenova/subscriptions","organizations_url":"https://api.github.com/users/bazhenova/orgs","repos_url":"https://api.github.com/users/bazhenova/repos","events_url":"https://api.github.com/users/bazhenova/events{/privacy}","received_events_url":"https://api.github.com/users/bazhenova/received_events","type":"User","site_admin":false},"assignees":[{"login":"bazhenova","id":12410663,"avatar_url":"https://avatars.githubusercontent.com/u/12410663?v=3","gravatar_id":"","url":"https://api.github.com/users/bazhenova","html_url":"https://github.com/bazhenova","followers_url":"https://api.github.com/users/bazhenova/followers","following_url":"https://api.github.com/users/bazhenova/following{/other_user}","gists_url":"https://api.github.com/users/bazhenova/gists{/gist_id}","starred_url":"https://api.github.com/users/bazhenova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bazhenova/subscriptions","organizations_url":"https://api.github.com/users/bazhenova/orgs","repos_url":"https://api.github.com/users/bazhenova/repos","events_url":"https://api.github.com/users/bazhenova/events{/privacy}","received_events_url":"https://api.github.com/users/bazhenova/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/28/commits","review_comments_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/28/comments","review_comment_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/issues/28/comments","statuses_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/statuses/4cd0f747c8a0cda1b7b5dc16f90113d7551efeea","head":{"label":"tgkd:master","ref":"master","sha":"4cd0f747c8a0cda1b7b5dc16f90113d7551efeea","user":{"login":"tgkd","id":6171708,"avatar_url":"https://avatars.githubusercontent.com/u/6171708?v=3","gravatar_id":"","url":"https://api.github.com/users/tgkd","html_url":"https://github.com/tgkd","followers_url":"https://api.github.com/users/tgkd/followers","following_url":"https://api.github.com/users/tgkd/following{/other_user}","gists_url":"https://api.github.com/users/tgkd/gists{/gist_id}","starred_url":"https://api.github.com/users/tgkd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgkd/subscriptions","organizations_url":"https://api.github.com/users/tgkd/orgs","repos_url":"https://api.github.com/users/tgkd/repos","events_url":"https://api.github.com/users/tgkd/events{/privacy}","received_events_url":"https://api.github.com/users/tgkd/received_events","type":"User","site_admin":false},"repo":{"id":72517442,"name":"javascript-task-4","full_name":"tgkd/javascript-task-4","owner":{"login":"tgkd","id":6171708,"avatar_url":"https://avatars.githubusercontent.com/u/6171708?v=3","gravatar_id":"","url":"https://api.github.com/users/tgkd","html_url":"https://github.com/tgkd","followers_url":"https://api.github.com/users/tgkd/followers","following_url":"https://api.github.com/users/tgkd/following{/other_user}","gists_url":"https://api.github.com/users/tgkd/gists{/gist_id}","starred_url":"https://api.github.com/users/tgkd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgkd/subscriptions","organizations_url":"https://api.github.com/users/tgkd/orgs","repos_url":"https://api.github.com/users/tgkd/repos","events_url":"https://api.github.com/users/tgkd/events{/privacy}","received_events_url":"https://api.github.com/users/tgkd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tgkd/javascript-task-4","description":"Задача «Картофельная вечеринка Билли»","fork":true,"url":"https://api.github.com/repos/tgkd/javascript-task-4","forks_url":"https://api.github.com/repos/tgkd/javascript-task-4/forks","keys_url":"https://api.github.com/repos/tgkd/javascript-task-4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tgkd/javascript-task-4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tgkd/javascript-task-4/teams","hooks_url":"https://api.github.com/repos/tgkd/javascript-task-4/hooks","issue_events_url":"https://api.github.com/repos/tgkd/javascript-task-4/issues/events{/number}","events_url":"https://api.github.com/repos/tgkd/javascript-task-4/events","assignees_url":"https://api.github.com/repos/tgkd/javascript-task-4/assignees{/user}","branches_url":"https://api.github.com/repos/tgkd/javascript-task-4/branches{/branch}","tags_url":"https://api.github.com/repos/tgkd/javascript-task-4/tags","blobs_url":"https://api.github.com/repos/tgkd/javascript-task-4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tgkd/javascript-task-4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tgkd/javascript-task-4/git/refs{/sha}","trees_url":"https://api.github.com/repos/tgkd/javascript-task-4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tgkd/javascript-task-4/statuses/{sha}","languages_url":"https://api.github.com/repos/tgkd/javascript-task-4/languages","stargazers_url":"https://api.github.com/repos/tgkd/javascript-task-4/stargazers","contributors_url":"https://api.github.com/repos/tgkd/javascript-task-4/contributors","subscribers_url":"https://api.github.com/repos/tgkd/javascript-task-4/subscribers","subscription_url":"https://api.github.com/repos/tgkd/javascript-task-4/subscription","commits_url":"https://api.github.com/repos/tgkd/javascript-task-4/commits{/sha}","git_commits_url":"https://api.github.com/repos/tgkd/javascript-task-4/git/commits{/sha}","comments_url":"https://api.github.com/repos/tgkd/javascript-task-4/comments{/number}","issue_comment_url":"https://api.github.com/repos/tgkd/javascript-task-4/issues/comments{/number}","contents_url":"https://api.github.com/repos/tgkd/javascript-task-4/contents/{+path}","compare_url":"https://api.github.com/repos/tgkd/javascript-task-4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tgkd/javascript-task-4/merges","archive_url":"https://api.github.com/repos/tgkd/javascript-task-4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tgkd/javascript-task-4/downloads","issues_url":"https://api.github.com/repos/tgkd/javascript-task-4/issues{/number}","pulls_url":"https://api.github.com/repos/tgkd/javascript-task-4/pulls{/number}","milestones_url":"https://api.github.com/repos/tgkd/javascript-task-4/milestones{/number}","notifications_url":"https://api.github.com/repos/tgkd/javascript-task-4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tgkd/javascript-task-4/labels{/name}","releases_url":"https://api.github.com/repos/tgkd/javascript-task-4/releases{/id}","deployments_url":"https://api.github.com/repos/tgkd/javascript-task-4/deployments","created_at":"2016-11-01T08:24:30Z","updated_at":"2016-11-01T08:24:31Z","pushed_at":"2016-11-01T16:36:41Z","git_url":"git://github.com/tgkd/javascript-task-4.git","ssh_url":"git@github.com:tgkd/javascript-task-4.git","clone_url":"https://github.com/tgkd/javascript-task-4.git","svn_url":"https://github.com/tgkd/javascript-task-4","homepage":"","size":6,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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-2016:master","ref":"master","sha":"7478a115049e4e20247defea7e2f8dc6f49a8239","user":{"login":"urfu-2016","id":22170529,"avatar_url":"https://avatars.githubusercontent.com/u/22170529?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2016","html_url":"https://github.com/urfu-2016","followers_url":"https://api.github.com/users/urfu-2016/followers","following_url":"https://api.github.com/users/urfu-2016/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2016/subscriptions","organizations_url":"https://api.github.com/users/urfu-2016/orgs","repos_url":"https://api.github.com/users/urfu-2016/repos","events_url":"https://api.github.com/users/urfu-2016/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2016/received_events","type":"Organization","site_admin":false},"repo":{"id":71762351,"name":"javascript-task-4","full_name":"urfu-2016/javascript-task-4","owner":{"login":"urfu-2016","id":22170529,"avatar_url":"https://avatars.githubusercontent.com/u/22170529?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2016","html_url":"https://github.com/urfu-2016","followers_url":"https://api.github.com/users/urfu-2016/followers","following_url":"https://api.github.com/users/urfu-2016/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2016/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2016/subscriptions","organizations_url":"https://api.github.com/users/urfu-2016/orgs","repos_url":"https://api.github.com/users/urfu-2016/repos","events_url":"https://api.github.com/users/urfu-2016/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2016/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urfu-2016/javascript-task-4","description":"Задача «Картофельная вечеринка Билли»","fork":false,"url":"https://api.github.com/repos/urfu-2016/javascript-task-4","forks_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/forks","keys_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/teams","hooks_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/hooks","issue_events_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/events","assignees_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/tags","blobs_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/languages","stargazers_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/stargazers","contributors_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/contributors","subscribers_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/subscribers","subscription_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/subscription","commits_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/merges","archive_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/downloads","issues_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/releases{/id}","deployments_url":"https://api.github.com/repos/urfu-2016/javascript-task-4/deployments","created_at":"2016-10-24T07:19:05Z","updated_at":"2016-10-27T17:04:42Z","pushed_at":"2016-11-04T19:17:32Z","git_url":"git://github.com/urfu-2016/javascript-task-4.git","ssh_url":"git@github.com:urfu-2016/javascript-task-4.git","clone_url":"https://github.com/urfu-2016/javascript-task-4.git","svn_url":"https://github.com/urfu-2016/javascript-task-4","homepage":"","size":13,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":58,"forks":80,"open_issues":58,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/28"},"html":{"href":"https://github.com/urfu-2016/javascript-task-4/pull/28"},"issue":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/issues/28"},"comments":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2016/javascript-task-4/statuses/4cd0f747c8a0cda1b7b5dc16f90113d7551efeea"}}}}
{"actor":{"display_login":"bazhenova"}}