{"action":"created","comment":{"url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/comments/168755618","pull_request_review_id":97176680,"id":168755618,"diff_hunk":"@@ -6,33 +6,31 @@ const author = require(`./src/author`);\n const license = require(`./src/license`);\n const description = require(`./src/description`);\n \n-const argumentsMap = {\n-  [`--${version.name}`]: () => version.execute(),\n-  [`--${help.name}`]: () => help.execute(),\n-  [`--${author.name}`]: () => author.execute(),\n-  [`--${license.name}`]: () => license.execute(),\n-  [`--${description.name}`]: () => description.execute(),\n-};\n+const commands = [version, help, author, license, description];\n+\n+const isCommandExist = (arg) => commands.find((item) => item.name === arg);\n \n const onWrongParam = (param) => {\n   error.execute(param);\n   process.exit(1);\n };\n \n const checkUserParam = (arg) => {\n-  if (arg && argumentsMap[arg]) {\n-    argumentsMap[arg]();\n-    return;\n-  }\n-\n   if (arg) {\n-    onWrongParam(arg);\n-    return;\n+    const command = isCommandExist(arg.replace(`--`, ``));\n+\n+    if (command) {\n+      command.execute();\n+      return;\n+    } else {\n+      onWrongParam(arg);\n+      return;\n+    }\n   }\n \n   noParams.execute();\n };\n \n-const userArgument = process.argv.slice(2)[0];\n+const [, , userArgument] = process.argv;","path":"index.js","position":null,"original_position":44,"commit_id":"0902143211220965529cf0b31a038e17d94185e5","original_commit_id":"0902143211220965529cf0b31a038e17d94185e5","user":{"login":"dreamniker","id":6843465,"avatar_url":"https://avatars1.githubusercontent.com/u/6843465?v=4","gravatar_id":"","url":"https://api.github.com/users/dreamniker","html_url":"https://github.com/dreamniker","followers_url":"https://api.github.com/users/dreamniker/followers","following_url":"https://api.github.com/users/dreamniker/following{/other_user}","gists_url":"https://api.github.com/users/dreamniker/gists{/gist_id}","starred_url":"https://api.github.com/users/dreamniker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreamniker/subscriptions","organizations_url":"https://api.github.com/users/dreamniker/orgs","repos_url":"https://api.github.com/users/dreamniker/repos","events_url":"https://api.github.com/users/dreamniker/events{/privacy}","received_events_url":"https://api.github.com/users/dreamniker/received_events","type":"User","site_admin":false},"body":"хитро, но таким лучше не злоупотреблять, slice читабельнее, имхо :)","created_at":"2018-02-16T13:28:48Z","updated_at":"2018-02-16T13:29:23Z","html_url":"https://github.com/htmlacademy-nodejs/145057-kekstagram/pull/4#discussion_r168755618","pull_request_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/4","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/comments/168755618"},"html":{"href":"https://github.com/htmlacademy-nodejs/145057-kekstagram/pull/4#discussion_r168755618"},"pull_request":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/4","id":169211199,"html_url":"https://github.com/htmlacademy-nodejs/145057-kekstagram/pull/4","diff_url":"https://github.com/htmlacademy-nodejs/145057-kekstagram/pull/4.diff","patch_url":"https://github.com/htmlacademy-nodejs/145057-kekstagram/pull/4.patch","issue_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/issues/4","number":4,"state":"open","locked":false,"title":"Разделить, не смешивать","user":{"login":"itslooklike","id":17547664,"avatar_url":"https://avatars2.githubusercontent.com/u/17547664?v=4","gravatar_id":"","url":"https://api.github.com/users/itslooklike","html_url":"https://github.com/itslooklike","followers_url":"https://api.github.com/users/itslooklike/followers","following_url":"https://api.github.com/users/itslooklike/following{/other_user}","gists_url":"https://api.github.com/users/itslooklike/gists{/gist_id}","starred_url":"https://api.github.com/users/itslooklike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itslooklike/subscriptions","organizations_url":"https://api.github.com/users/itslooklike/orgs","repos_url":"https://api.github.com/users/itslooklike/repos","events_url":"https://api.github.com/users/itslooklike/events{/privacy}","received_events_url":"https://api.github.com/users/itslooklike/received_events","type":"User","site_admin":false},"body":"\n\n---\n:mortar_board: [Разделить, не смешивать](https://up.htmlacademy.ru/nodejs/1/user/145057/tasks/5)","created_at":"2018-02-14T20:16:19Z","updated_at":"2018-02-16T13:29:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"38c3bcb4ea9274ca71cbb1d46f301b2cb86cfdc6","assignee":{"login":"dreamniker","id":6843465,"avatar_url":"https://avatars1.githubusercontent.com/u/6843465?v=4","gravatar_id":"","url":"https://api.github.com/users/dreamniker","html_url":"https://github.com/dreamniker","followers_url":"https://api.github.com/users/dreamniker/followers","following_url":"https://api.github.com/users/dreamniker/following{/other_user}","gists_url":"https://api.github.com/users/dreamniker/gists{/gist_id}","starred_url":"https://api.github.com/users/dreamniker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreamniker/subscriptions","organizations_url":"https://api.github.com/users/dreamniker/orgs","repos_url":"https://api.github.com/users/dreamniker/repos","events_url":"https://api.github.com/users/dreamniker/events{/privacy}","received_events_url":"https://api.github.com/users/dreamniker/received_events","type":"User","site_admin":false},"assignees":[{"login":"dreamniker","id":6843465,"avatar_url":"https://avatars1.githubusercontent.com/u/6843465?v=4","gravatar_id":"","url":"https://api.github.com/users/dreamniker","html_url":"https://github.com/dreamniker","followers_url":"https://api.github.com/users/dreamniker/followers","following_url":"https://api.github.com/users/dreamniker/following{/other_user}","gists_url":"https://api.github.com/users/dreamniker/gists{/gist_id}","starred_url":"https://api.github.com/users/dreamniker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreamniker/subscriptions","organizations_url":"https://api.github.com/users/dreamniker/orgs","repos_url":"https://api.github.com/users/dreamniker/repos","events_url":"https://api.github.com/users/dreamniker/events{/privacy}","received_events_url":"https://api.github.com/users/dreamniker/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/4/commits","review_comments_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/4/comments","review_comment_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/issues/4/comments","statuses_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/statuses/0902143211220965529cf0b31a038e17d94185e5","head":{"label":"itslooklike:module2-task2","ref":"module2-task2","sha":"0902143211220965529cf0b31a038e17d94185e5","user":{"login":"itslooklike","id":17547664,"avatar_url":"https://avatars2.githubusercontent.com/u/17547664?v=4","gravatar_id":"","url":"https://api.github.com/users/itslooklike","html_url":"https://github.com/itslooklike","followers_url":"https://api.github.com/users/itslooklike/followers","following_url":"https://api.github.com/users/itslooklike/following{/other_user}","gists_url":"https://api.github.com/users/itslooklike/gists{/gist_id}","starred_url":"https://api.github.com/users/itslooklike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itslooklike/subscriptions","organizations_url":"https://api.github.com/users/itslooklike/orgs","repos_url":"https://api.github.com/users/itslooklike/repos","events_url":"https://api.github.com/users/itslooklike/events{/privacy}","received_events_url":"https://api.github.com/users/itslooklike/received_events","type":"User","site_admin":false},"repo":{"id":121428130,"name":"145057-kekstagram-nodejs","full_name":"itslooklike/145057-kekstagram-nodejs","owner":{"login":"itslooklike","id":17547664,"avatar_url":"https://avatars2.githubusercontent.com/u/17547664?v=4","gravatar_id":"","url":"https://api.github.com/users/itslooklike","html_url":"https://github.com/itslooklike","followers_url":"https://api.github.com/users/itslooklike/followers","following_url":"https://api.github.com/users/itslooklike/following{/other_user}","gists_url":"https://api.github.com/users/itslooklike/gists{/gist_id}","starred_url":"https://api.github.com/users/itslooklike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itslooklike/subscriptions","organizations_url":"https://api.github.com/users/itslooklike/orgs","repos_url":"https://api.github.com/users/itslooklike/repos","events_url":"https://api.github.com/users/itslooklike/events{/privacy}","received_events_url":"https://api.github.com/users/itslooklike/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/itslooklike/145057-kekstagram-nodejs","description":"Алексей Масалов","fork":true,"url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs","forks_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/forks","keys_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/teams","hooks_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/hooks","issue_events_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/issues/events{/number}","events_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/events","assignees_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/assignees{/user}","branches_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/branches{/branch}","tags_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/tags","blobs_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/git/refs{/sha}","trees_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/statuses/{sha}","languages_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/languages","stargazers_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/stargazers","contributors_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/contributors","subscribers_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/subscribers","subscription_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/subscription","commits_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/commits{/sha}","git_commits_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/git/commits{/sha}","comments_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/comments{/number}","issue_comment_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/issues/comments{/number}","contents_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/contents/{+path}","compare_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/merges","archive_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/downloads","issues_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/issues{/number}","pulls_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/pulls{/number}","milestones_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/milestones{/number}","notifications_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/labels{/name}","releases_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/releases{/id}","deployments_url":"https://api.github.com/repos/itslooklike/145057-kekstagram-nodejs/deployments","created_at":"2018-02-13T19:44:10Z","updated_at":"2018-02-13T20:08:43Z","pushed_at":"2018-02-16T13:19:56Z","git_url":"git://github.com/itslooklike/145057-kekstagram-nodejs.git","ssh_url":"git@github.com:itslooklike/145057-kekstagram-nodejs.git","clone_url":"https://github.com/itslooklike/145057-kekstagram-nodejs.git","svn_url":"https://github.com/itslooklike/145057-kekstagram-nodejs","homepage":null,"size":31,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"htmlacademy-nodejs:master","ref":"master","sha":"3c832e72fe0b59831c531ce899cfd9da88cd153d","user":{"login":"htmlacademy-nodejs","id":23528374,"avatar_url":"https://avatars0.githubusercontent.com/u/23528374?v=4","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-nodejs","html_url":"https://github.com/htmlacademy-nodejs","followers_url":"https://api.github.com/users/htmlacademy-nodejs/followers","following_url":"https://api.github.com/users/htmlacademy-nodejs/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-nodejs/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-nodejs/orgs","repos_url":"https://api.github.com/users/htmlacademy-nodejs/repos","events_url":"https://api.github.com/users/htmlacademy-nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":121428088,"name":"145057-kekstagram","full_name":"htmlacademy-nodejs/145057-kekstagram","owner":{"login":"htmlacademy-nodejs","id":23528374,"avatar_url":"https://avatars0.githubusercontent.com/u/23528374?v=4","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-nodejs","html_url":"https://github.com/htmlacademy-nodejs","followers_url":"https://api.github.com/users/htmlacademy-nodejs/followers","following_url":"https://api.github.com/users/htmlacademy-nodejs/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-nodejs/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-nodejs/orgs","repos_url":"https://api.github.com/users/htmlacademy-nodejs/repos","events_url":"https://api.github.com/users/htmlacademy-nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/htmlacademy-nodejs/145057-kekstagram","description":"Алексей Масалов","fork":false,"url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram","forks_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/forks","keys_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/teams","hooks_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/hooks","issue_events_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/issues/events{/number}","events_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/events","assignees_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/assignees{/user}","branches_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/branches{/branch}","tags_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/tags","blobs_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/statuses/{sha}","languages_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/languages","stargazers_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/stargazers","contributors_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/contributors","subscribers_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/subscribers","subscription_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/subscription","commits_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/issues/comments{/number}","contents_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/contents/{+path}","compare_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/merges","archive_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/downloads","issues_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/issues{/number}","pulls_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls{/number}","milestones_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/milestones{/number}","notifications_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/labels{/name}","releases_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/releases{/id}","deployments_url":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/deployments","created_at":"2018-02-13T19:43:51Z","updated_at":"2018-02-15T07:31:57Z","pushed_at":"2018-02-16T13:07:15Z","git_url":"git://github.com/htmlacademy-nodejs/145057-kekstagram.git","ssh_url":"git@github.com:htmlacademy-nodejs/145057-kekstagram.git","clone_url":"https://github.com/htmlacademy-nodejs/145057-kekstagram.git","svn_url":"https://github.com/htmlacademy-nodejs/145057-kekstagram","homepage":"https://github.com/itslooklike/145057-kekstagram-nodejs","size":17,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/4"},"html":{"href":"https://github.com/htmlacademy-nodejs/145057-kekstagram/pull/4"},"issue":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/issues/4"},"comments":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/htmlacademy-nodejs/145057-kekstagram/statuses/0902143211220965529cf0b31a038e17d94185e5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dreamniker"}}