{"action":"created","comment":{"url":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/comments/89055364","pull_request_review_id":9606071,"id":89055364,"diff_hunk":"@@ -0,0 +1,88 @@\n+/*\n+* InvertedIndex Class\n+*/\n+class invertedIndex {\n+\n+  constructor() {\n+    this.indexMap = {};\n+  }\n+\n+\n+  sanitize(indexes) {\n+    let lowerindex = [];\n+    indexes.map((word) => {\n+      lowerindex.push(word.toLowerCase().replace(/[!''@#$%^&*,'.]/g, \"\"));\n+    });\n+    return lowerindex;\n+  }\n+\n+\t/*\n+\t* Create File Index\n+\t*/\n+  createIndex(fileName, fileContent) {\n+    let completeIndex = [];\n+    for (let value of fileContent) {\n+      let title = value.title;\n+      let splitTitle = title.split(' ');\n+      let textTitle = this.sanitize(splitTitle);\n+\n+      let text = value.text;\n+      let splitText = text.split(' ');\n+      let content = this.sanitize(splitText);\n+\n+      let mergeWords = content.concat(textTitle);\n+      completeIndex.push(mergeWords);\n+    }\n+    this.storeIndex(fileName, completeIndex);\n+    return [fileName, completeIndex];\n+  }\n+\n+\n+\t/*\n+\t* Stores the File Index\n+\t*/\n+  storeIndex(textTitle, completeIndex) {\n+    const words = {}\n+\n+    for (let pos in completeIndex) {\n+      completeIndex[pos].forEach((word) => {\n+        if (words[word]) {\n+          if (words[word].indexOf(pos) === -1) {\n+            words[word].push(pos);\n+          }\n+        } else {\n+          words[word] = [pos];\n+        }\n+      });\n+    }\n+    return this.indexMap[textTitle] = words;\n+  }\n+\n+\t/*\n+\t* Get File Index\n+\t*/\n+  getIndex(title) {\n+    return this.indexMap[title];\n+  }\n+\n+\n+\t/**\n+\t * Search for Terms\n+\t */\n+  searchIndex(terms) {\n+    const searchResult = {};\n+    let a = terms.split(' ');\n+    var result = this.indexMap;\n+    let keys = Object.keys(result);\n+\n+    for (let key in keys) {","path":"src/scripts/inverted-index.js","position":78,"original_position":78,"commit_id":"18a4cf8026f09726105e0660af997700cf5a6ef6","original_commit_id":"18a4cf8026f09726105e0660af997700cf5a6ef6","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).","created_at":"2016-11-22T07:27:58Z","updated_at":"2016-11-22T07:27:58Z","html_url":"https://github.com/andela-sayidu/invertedIndex/pull/1#discussion_r89055364","pull_request_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/comments/89055364"},"html":{"href":"https://github.com/andela-sayidu/invertedIndex/pull/1#discussion_r89055364"},"pull_request":{"href":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/1","id":94761241,"html_url":"https://github.com/andela-sayidu/invertedIndex/pull/1","diff_url":"https://github.com/andela-sayidu/invertedIndex/pull/1.diff","patch_url":"https://github.com/andela-sayidu/invertedIndex/pull/1.patch","issue_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues/1","number":1,"state":"open","locked":false,"title":"Pull request for pair review","user":{"login":"andela-sayidu","id":23451229,"avatar_url":"https://avatars.githubusercontent.com/u/23451229?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-sayidu","html_url":"https://github.com/andela-sayidu","followers_url":"https://api.github.com/users/andela-sayidu/followers","following_url":"https://api.github.com/users/andela-sayidu/following{/other_user}","gists_url":"https://api.github.com/users/andela-sayidu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-sayidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-sayidu/subscriptions","organizations_url":"https://api.github.com/users/andela-sayidu/orgs","repos_url":"https://api.github.com/users/andela-sayidu/repos","events_url":"https://api.github.com/users/andela-sayidu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-sayidu/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-22T07:27:50Z","updated_at":"2016-11-22T07:27:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"942d321a4ba4e019f5f8f4222b87431d36a7d2ac","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/1/commits","review_comments_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/1/comments","review_comment_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues/1/comments","statuses_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/statuses/18a4cf8026f09726105e0660af997700cf5a6ef6","head":{"label":"andela-sayidu:develop","ref":"develop","sha":"18a4cf8026f09726105e0660af997700cf5a6ef6","user":{"login":"andela-sayidu","id":23451229,"avatar_url":"https://avatars.githubusercontent.com/u/23451229?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-sayidu","html_url":"https://github.com/andela-sayidu","followers_url":"https://api.github.com/users/andela-sayidu/followers","following_url":"https://api.github.com/users/andela-sayidu/following{/other_user}","gists_url":"https://api.github.com/users/andela-sayidu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-sayidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-sayidu/subscriptions","organizations_url":"https://api.github.com/users/andela-sayidu/orgs","repos_url":"https://api.github.com/users/andela-sayidu/repos","events_url":"https://api.github.com/users/andela-sayidu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-sayidu/received_events","type":"User","site_admin":false},"repo":{"id":74242569,"name":"invertedIndex","full_name":"andela-sayidu/invertedIndex","owner":{"login":"andela-sayidu","id":23451229,"avatar_url":"https://avatars.githubusercontent.com/u/23451229?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-sayidu","html_url":"https://github.com/andela-sayidu","followers_url":"https://api.github.com/users/andela-sayidu/followers","following_url":"https://api.github.com/users/andela-sayidu/following{/other_user}","gists_url":"https://api.github.com/users/andela-sayidu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-sayidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-sayidu/subscriptions","organizations_url":"https://api.github.com/users/andela-sayidu/orgs","repos_url":"https://api.github.com/users/andela-sayidu/repos","events_url":"https://api.github.com/users/andela-sayidu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-sayidu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-sayidu/invertedIndex","description":"Checkpoint 1: Inverted Index Project","fork":false,"url":"https://api.github.com/repos/andela-sayidu/invertedIndex","forks_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/forks","keys_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/teams","hooks_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/hooks","issue_events_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues/events{/number}","events_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/events","assignees_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/assignees{/user}","branches_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/branches{/branch}","tags_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/tags","blobs_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/languages","stargazers_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/stargazers","contributors_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/contributors","subscribers_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/subscribers","subscription_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/subscription","commits_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/contents/{+path}","compare_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/merges","archive_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/downloads","issues_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues{/number}","pulls_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/labels{/name}","releases_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/releases{/id}","deployments_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/deployments","created_at":"2016-11-19T23:48:56Z","updated_at":"2016-11-20T07:26:00Z","pushed_at":"2016-11-22T07:27:50Z","git_url":"git://github.com/andela-sayidu/invertedIndex.git","ssh_url":"git@github.com:andela-sayidu/invertedIndex.git","clone_url":"https://github.com/andela-sayidu/invertedIndex.git","svn_url":"https://github.com/andela-sayidu/invertedIndex","homepage":null,"size":41002,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"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":"andela-sayidu:master","ref":"master","sha":"8574f3465e0348d1b913aefcb06d15bac5ac063c","user":{"login":"andela-sayidu","id":23451229,"avatar_url":"https://avatars.githubusercontent.com/u/23451229?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-sayidu","html_url":"https://github.com/andela-sayidu","followers_url":"https://api.github.com/users/andela-sayidu/followers","following_url":"https://api.github.com/users/andela-sayidu/following{/other_user}","gists_url":"https://api.github.com/users/andela-sayidu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-sayidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-sayidu/subscriptions","organizations_url":"https://api.github.com/users/andela-sayidu/orgs","repos_url":"https://api.github.com/users/andela-sayidu/repos","events_url":"https://api.github.com/users/andela-sayidu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-sayidu/received_events","type":"User","site_admin":false},"repo":{"id":74242569,"name":"invertedIndex","full_name":"andela-sayidu/invertedIndex","owner":{"login":"andela-sayidu","id":23451229,"avatar_url":"https://avatars.githubusercontent.com/u/23451229?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-sayidu","html_url":"https://github.com/andela-sayidu","followers_url":"https://api.github.com/users/andela-sayidu/followers","following_url":"https://api.github.com/users/andela-sayidu/following{/other_user}","gists_url":"https://api.github.com/users/andela-sayidu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-sayidu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-sayidu/subscriptions","organizations_url":"https://api.github.com/users/andela-sayidu/orgs","repos_url":"https://api.github.com/users/andela-sayidu/repos","events_url":"https://api.github.com/users/andela-sayidu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-sayidu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-sayidu/invertedIndex","description":"Checkpoint 1: Inverted Index Project","fork":false,"url":"https://api.github.com/repos/andela-sayidu/invertedIndex","forks_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/forks","keys_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/teams","hooks_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/hooks","issue_events_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues/events{/number}","events_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/events","assignees_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/assignees{/user}","branches_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/branches{/branch}","tags_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/tags","blobs_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/languages","stargazers_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/stargazers","contributors_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/contributors","subscribers_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/subscribers","subscription_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/subscription","commits_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/contents/{+path}","compare_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/merges","archive_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/downloads","issues_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues{/number}","pulls_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/labels{/name}","releases_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/releases{/id}","deployments_url":"https://api.github.com/repos/andela-sayidu/invertedIndex/deployments","created_at":"2016-11-19T23:48:56Z","updated_at":"2016-11-20T07:26:00Z","pushed_at":"2016-11-22T07:27:50Z","git_url":"git://github.com/andela-sayidu/invertedIndex.git","ssh_url":"git@github.com:andela-sayidu/invertedIndex.git","clone_url":"https://github.com/andela-sayidu/invertedIndex.git","svn_url":"https://github.com/andela-sayidu/invertedIndex","homepage":null,"size":41002,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"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/andela-sayidu/invertedIndex/pulls/1"},"html":{"href":"https://github.com/andela-sayidu/invertedIndex/pull/1"},"issue":{"href":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues/1"},"comments":{"href":"https://api.github.com/repos/andela-sayidu/invertedIndex/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela-sayidu/invertedIndex/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/andela-sayidu/invertedIndex/statuses/18a4cf8026f09726105e0660af997700cf5a6ef6"}}}}
{"actor":{"display_login":"houndci-bot"}}