{"action":"created","comment":{"url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/comments/236304990","pull_request_review_id":178348719,"id":236304990,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjMwNDk5MA==","diff_hunk":"@@ -2,38 +2,72 @@\n  * Функция принимает массив\n  * Функция должна вернуть \"настоящюю длинну массива\" [1,2,3,4,5] => 5 | [1,2,3,4, ... пустота... 10] => 5\n  */\n-function trueLength(array) {}\n+function trueLength(array) {\n+  return Object.keys(array).length;\n+}\n \n /**\n  * Функция принимает строку, содержащую последовательность круглых, квадратных или фигурных скобок - \"let obj = { numArray: [ ((1 + 2) * 5) + (42).toString() ] }\"\n  * Функция должна вернуть true если все скобки закрыты в правильном порядке или false в противном случае\n  */\n-function isExpressionValid(expression) {}\n+function isExpressionValid(expression) {\n+  let stack = [];\n+  for (let i = 0; i < expression.length; i += 1) {\n+    let elem = expression[i];\n+    if (elem === \"{\" || elem === \"[\" || elem === \"(\") {\n+      stack.push(elem);\n+    }\n+    if (elem === \"}\" && stack[stack.length - 1] === \"{\") {\n+      stack.pop();\n+    }\n+    if (elem === \"]\" && stack[stack.length - 1] === \"[\") {\n+      stack.pop();\n+    }\n+    if (elem === \")\" && stack[stack.length - 1] === \"(\") {\n+      stack.pop();\n+    }\n+  }\n+  return stack.length === 0 ? true : false;\n+}\n \n /**\n  * Функция принимает массив имен. Имена могут быть в любом виде: пЕтя, Артём, катя, МаШа\n  * Функция должна вернуть строку с нормализованными именами, разделёнными запятой и пробелом: \"Петя, Артём, Катя, Маша\"\n  */\n-function getCapitalizedNamesString(names) {}\n+function getCapitalizedNamesString(names) {\n+  let temp = [];\n+  names.map(value => {\n+    value = value.toLowerCase();\n+    value = value[0].toUpperCase() + value.slice(1);\n+    temp.push(value);\n+  });\n+  return temp.join(\", \");\n+}\n \n /**\n  * Функция принимает массив объектов вида { id: 1, name: \"Иван\", age: 42 }\n  * Функция должна вернуть массив таких же объектов, отсортированных по именам (в алфавитном порядке). НЕ ИСПОЛЬЗУЙТЕ ЦИКЛЫ.\n  */\n-function sortByName(users) {}\n+function sortByName(users) {\n+  return users.sort((a, b) => a.name.localeCompare(b.name));\n+}\n \n-/**\n+/*\n  * Функция принимает массив объектов вида { id: 1, name: \"Иван\", age: 42 }\n  * Функция должна вернуть массив имён пользователей которым исполнилось 18 лет. НЕ ИСПОЛЬЗУЙТЕ ЦИКЛЫ.\n \n  */\n-function getEligibleUserNames(users) {}\n+function getEligibleUserNames(users) {\n+  return users.filter(user => user.age >= 18).map(user => user.name);\n+}\n \n /**\n  * Функция принимает массив покупок вида { name: \"Морковь\", amount: 3, price: 2.50 }\n  * Функция должна вернуть сумму всех покупок. НЕ ИСПОЛЬЗУЙТЕ ЦИКЛЫ.\n  */\n-function calculateCart(items) {}\n+function calculateCart(items) {\n+  return items.reduce((sum, items) => (sum += items.price * items.amount), 0);","path":"src/tasks/4_arrays.js","position":75,"original_position":75,"commit_id":"7879293d6c94d5ead0fa7e2359a6415abb4531c4","original_commit_id":"7879293d6c94d5ead0fa7e2359a6415abb4531c4","user":{"login":"sergey-shulyak","id":22372739,"node_id":"MDQ6VXNlcjIyMzcyNzM5","avatar_url":"https://avatars0.githubusercontent.com/u/22372739?v=4","gravatar_id":"","url":"https://api.github.com/users/sergey-shulyak","html_url":"https://github.com/sergey-shulyak","followers_url":"https://api.github.com/users/sergey-shulyak/followers","following_url":"https://api.github.com/users/sergey-shulyak/following{/other_user}","gists_url":"https://api.github.com/users/sergey-shulyak/gists{/gist_id}","starred_url":"https://api.github.com/users/sergey-shulyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergey-shulyak/subscriptions","organizations_url":"https://api.github.com/users/sergey-shulyak/orgs","repos_url":"https://api.github.com/users/sergey-shulyak/repos","events_url":"https://api.github.com/users/sergey-shulyak/events{/privacy}","received_events_url":"https://api.github.com/users/sergey-shulyak/received_events","type":"User","site_admin":false},"body":"Это не совсем правильная форма функции для reduce. Нельзя мутировать аккумулятор, нужно возвращать новое значение.\r\nдолжно быть так: `=> sum + items.price * items.amount`","created_at":"2018-11-26T15:40:33Z","updated_at":"2018-11-26T15:48:14Z","html_url":"https://github.com/sergey-shulyak/js-data-structures/pull/12#discussion_r236304990","pull_request_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/12","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/comments/236304990"},"html":{"href":"https://github.com/sergey-shulyak/js-data-structures/pull/12#discussion_r236304990"},"pull_request":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/12","id":233579562,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzNTc5NTYy","html_url":"https://github.com/sergey-shulyak/js-data-structures/pull/12","diff_url":"https://github.com/sergey-shulyak/js-data-structures/pull/12.diff","patch_url":"https://github.com/sergey-shulyak/js-data-structures/pull/12.patch","issue_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/issues/12","number":12,"state":"open","locked":false,"title":"Feature1","user":{"login":"RomanEDC","id":38275682,"node_id":"MDQ6VXNlcjM4Mjc1Njgy","avatar_url":"https://avatars2.githubusercontent.com/u/38275682?v=4","gravatar_id":"","url":"https://api.github.com/users/RomanEDC","html_url":"https://github.com/RomanEDC","followers_url":"https://api.github.com/users/RomanEDC/followers","following_url":"https://api.github.com/users/RomanEDC/following{/other_user}","gists_url":"https://api.github.com/users/RomanEDC/gists{/gist_id}","starred_url":"https://api.github.com/users/RomanEDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RomanEDC/subscriptions","organizations_url":"https://api.github.com/users/RomanEDC/orgs","repos_url":"https://api.github.com/users/RomanEDC/repos","events_url":"https://api.github.com/users/RomanEDC/events{/privacy}","received_events_url":"https://api.github.com/users/RomanEDC/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-26T14:37:21Z","updated_at":"2018-11-26T15:48:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51d6297aa2eb8d4c004cafd58cc9b558e302b382","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/12/commits","review_comments_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/12/comments","review_comment_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/issues/12/comments","statuses_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/statuses/7879293d6c94d5ead0fa7e2359a6415abb4531c4","head":{"label":"RomanEDC:feature1","ref":"feature1","sha":"7879293d6c94d5ead0fa7e2359a6415abb4531c4","user":{"login":"RomanEDC","id":38275682,"node_id":"MDQ6VXNlcjM4Mjc1Njgy","avatar_url":"https://avatars2.githubusercontent.com/u/38275682?v=4","gravatar_id":"","url":"https://api.github.com/users/RomanEDC","html_url":"https://github.com/RomanEDC","followers_url":"https://api.github.com/users/RomanEDC/followers","following_url":"https://api.github.com/users/RomanEDC/following{/other_user}","gists_url":"https://api.github.com/users/RomanEDC/gists{/gist_id}","starred_url":"https://api.github.com/users/RomanEDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RomanEDC/subscriptions","organizations_url":"https://api.github.com/users/RomanEDC/orgs","repos_url":"https://api.github.com/users/RomanEDC/repos","events_url":"https://api.github.com/users/RomanEDC/events{/privacy}","received_events_url":"https://api.github.com/users/RomanEDC/received_events","type":"User","site_admin":false},"repo":{"id":158805803,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg4MDU4MDM=","name":"js-data-structures","full_name":"RomanEDC/js-data-structures","private":false,"owner":{"login":"RomanEDC","id":38275682,"node_id":"MDQ6VXNlcjM4Mjc1Njgy","avatar_url":"https://avatars2.githubusercontent.com/u/38275682?v=4","gravatar_id":"","url":"https://api.github.com/users/RomanEDC","html_url":"https://github.com/RomanEDC","followers_url":"https://api.github.com/users/RomanEDC/followers","following_url":"https://api.github.com/users/RomanEDC/following{/other_user}","gists_url":"https://api.github.com/users/RomanEDC/gists{/gist_id}","starred_url":"https://api.github.com/users/RomanEDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RomanEDC/subscriptions","organizations_url":"https://api.github.com/users/RomanEDC/orgs","repos_url":"https://api.github.com/users/RomanEDC/repos","events_url":"https://api.github.com/users/RomanEDC/events{/privacy}","received_events_url":"https://api.github.com/users/RomanEDC/received_events","type":"User","site_admin":false},"html_url":"https://github.com/RomanEDC/js-data-structures","description":"Repo containing tasks for JS data-structures lecture","fork":true,"url":"https://api.github.com/repos/RomanEDC/js-data-structures","forks_url":"https://api.github.com/repos/RomanEDC/js-data-structures/forks","keys_url":"https://api.github.com/repos/RomanEDC/js-data-structures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RomanEDC/js-data-structures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RomanEDC/js-data-structures/teams","hooks_url":"https://api.github.com/repos/RomanEDC/js-data-structures/hooks","issue_events_url":"https://api.github.com/repos/RomanEDC/js-data-structures/issues/events{/number}","events_url":"https://api.github.com/repos/RomanEDC/js-data-structures/events","assignees_url":"https://api.github.com/repos/RomanEDC/js-data-structures/assignees{/user}","branches_url":"https://api.github.com/repos/RomanEDC/js-data-structures/branches{/branch}","tags_url":"https://api.github.com/repos/RomanEDC/js-data-structures/tags","blobs_url":"https://api.github.com/repos/RomanEDC/js-data-structures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RomanEDC/js-data-structures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RomanEDC/js-data-structures/git/refs{/sha}","trees_url":"https://api.github.com/repos/RomanEDC/js-data-structures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RomanEDC/js-data-structures/statuses/{sha}","languages_url":"https://api.github.com/repos/RomanEDC/js-data-structures/languages","stargazers_url":"https://api.github.com/repos/RomanEDC/js-data-structures/stargazers","contributors_url":"https://api.github.com/repos/RomanEDC/js-data-structures/contributors","subscribers_url":"https://api.github.com/repos/RomanEDC/js-data-structures/subscribers","subscription_url":"https://api.github.com/repos/RomanEDC/js-data-structures/subscription","commits_url":"https://api.github.com/repos/RomanEDC/js-data-structures/commits{/sha}","git_commits_url":"https://api.github.com/repos/RomanEDC/js-data-structures/git/commits{/sha}","comments_url":"https://api.github.com/repos/RomanEDC/js-data-structures/comments{/number}","issue_comment_url":"https://api.github.com/repos/RomanEDC/js-data-structures/issues/comments{/number}","contents_url":"https://api.github.com/repos/RomanEDC/js-data-structures/contents/{+path}","compare_url":"https://api.github.com/repos/RomanEDC/js-data-structures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RomanEDC/js-data-structures/merges","archive_url":"https://api.github.com/repos/RomanEDC/js-data-structures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RomanEDC/js-data-structures/downloads","issues_url":"https://api.github.com/repos/RomanEDC/js-data-structures/issues{/number}","pulls_url":"https://api.github.com/repos/RomanEDC/js-data-structures/pulls{/number}","milestones_url":"https://api.github.com/repos/RomanEDC/js-data-structures/milestones{/number}","notifications_url":"https://api.github.com/repos/RomanEDC/js-data-structures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RomanEDC/js-data-structures/labels{/name}","releases_url":"https://api.github.com/repos/RomanEDC/js-data-structures/releases{/id}","deployments_url":"https://api.github.com/repos/RomanEDC/js-data-structures/deployments","created_at":"2018-11-23T08:53:11Z","updated_at":"2018-11-23T08:53:13Z","pushed_at":"2018-11-26T14:36:47Z","git_url":"git://github.com/RomanEDC/js-data-structures.git","ssh_url":"git@github.com:RomanEDC/js-data-structures.git","clone_url":"https://github.com/RomanEDC/js-data-structures.git","svn_url":"https://github.com/RomanEDC/js-data-structures","homepage":null,"size":96,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sergey-shulyak:master","ref":"master","sha":"b3ae186e656a67a61a2b80b17f3ec56514ea1982","user":{"login":"sergey-shulyak","id":22372739,"node_id":"MDQ6VXNlcjIyMzcyNzM5","avatar_url":"https://avatars0.githubusercontent.com/u/22372739?v=4","gravatar_id":"","url":"https://api.github.com/users/sergey-shulyak","html_url":"https://github.com/sergey-shulyak","followers_url":"https://api.github.com/users/sergey-shulyak/followers","following_url":"https://api.github.com/users/sergey-shulyak/following{/other_user}","gists_url":"https://api.github.com/users/sergey-shulyak/gists{/gist_id}","starred_url":"https://api.github.com/users/sergey-shulyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergey-shulyak/subscriptions","organizations_url":"https://api.github.com/users/sergey-shulyak/orgs","repos_url":"https://api.github.com/users/sergey-shulyak/repos","events_url":"https://api.github.com/users/sergey-shulyak/events{/privacy}","received_events_url":"https://api.github.com/users/sergey-shulyak/received_events","type":"User","site_admin":false},"repo":{"id":158389715,"node_id":"MDEwOlJlcG9zaXRvcnkxNTgzODk3MTU=","name":"js-data-structures","full_name":"sergey-shulyak/js-data-structures","private":false,"owner":{"login":"sergey-shulyak","id":22372739,"node_id":"MDQ6VXNlcjIyMzcyNzM5","avatar_url":"https://avatars0.githubusercontent.com/u/22372739?v=4","gravatar_id":"","url":"https://api.github.com/users/sergey-shulyak","html_url":"https://github.com/sergey-shulyak","followers_url":"https://api.github.com/users/sergey-shulyak/followers","following_url":"https://api.github.com/users/sergey-shulyak/following{/other_user}","gists_url":"https://api.github.com/users/sergey-shulyak/gists{/gist_id}","starred_url":"https://api.github.com/users/sergey-shulyak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sergey-shulyak/subscriptions","organizations_url":"https://api.github.com/users/sergey-shulyak/orgs","repos_url":"https://api.github.com/users/sergey-shulyak/repos","events_url":"https://api.github.com/users/sergey-shulyak/events{/privacy}","received_events_url":"https://api.github.com/users/sergey-shulyak/received_events","type":"User","site_admin":false},"html_url":"https://github.com/sergey-shulyak/js-data-structures","description":"Repo containing tasks for JS data-structures lecture","fork":false,"url":"https://api.github.com/repos/sergey-shulyak/js-data-structures","forks_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/forks","keys_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/teams","hooks_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/hooks","issue_events_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/issues/events{/number}","events_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/events","assignees_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/assignees{/user}","branches_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/branches{/branch}","tags_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/tags","blobs_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/git/refs{/sha}","trees_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/statuses/{sha}","languages_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/languages","stargazers_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/stargazers","contributors_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/contributors","subscribers_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/subscribers","subscription_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/subscription","commits_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/commits{/sha}","git_commits_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/git/commits{/sha}","comments_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/comments{/number}","issue_comment_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/issues/comments{/number}","contents_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/contents/{+path}","compare_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/merges","archive_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/downloads","issues_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/issues{/number}","pulls_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls{/number}","milestones_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/milestones{/number}","notifications_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/labels{/name}","releases_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/releases{/id}","deployments_url":"https://api.github.com/repos/sergey-shulyak/js-data-structures/deployments","created_at":"2018-11-20T12:57:09Z","updated_at":"2018-11-23T11:35:45Z","pushed_at":"2018-11-26T14:38:15Z","git_url":"git://github.com/sergey-shulyak/js-data-structures.git","ssh_url":"git@github.com:sergey-shulyak/js-data-structures.git","clone_url":"https://github.com/sergey-shulyak/js-data-structures.git","svn_url":"https://github.com/sergey-shulyak/js-data-structures","homepage":null,"size":93,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":14,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/12"},"html":{"href":"https://github.com/sergey-shulyak/js-data-structures/pull/12"},"issue":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/issues/12"},"comments":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/sergey-shulyak/js-data-structures/statuses/7879293d6c94d5ead0fa7e2359a6415abb4531c4"}},"author_association":"NONE"}}
{"actor":{"display_login":"sergey-shulyak"}}