{"action":"created","comment":{"url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/comments/91190635","pull_request_review_id":11699668,"id":91190635,"diff_hunk":"@@ -14,154 +14,168 @@ class InvertedIndex {\n \n \n   /**\n-   * converts the string provided to lower case, strips the string of all \n+   * converts the string provided to lower case, strips the string of all\n    * special characters, extra spaces and converts the result into an Array\n-   * @static \n    * @param {string} text the text to be converted\n    * @returns {Array} the result that will be returned after function call\n    */\n-  static textToArray(text) {\n-    const result = text.toLowerCase().replace(/[^a-z0-9\\s]/g, \"\").split(/\\s+/);\n+  textToArray(text) {\n+    const result = text.toLowerCase().replace(/[^a-z0-9\\s]/g, '').split(/\\s+/);\n     return result;\n   }\n \n-\n   /**\n-   * loops through an array and removes duplicate elements\n-   * @static\n-   * @param {}\n-   * @returns {Array} \n+   * check the documents in the uploaded file and returns\n+   * the content of the file in a tokenized format\n+   * @param {Array} file the content of the file\n+   * @returns {Array} returns a boolean\n    */\n-  _sortIndex(bookName, arrayItem, element) {\n-    element = parseInt(element);\n-    for(let item in arrayItem) {\n-      if(!this.indexes[bookName].hasOwnProperty([arrayItem[item]])) {\n-        this.indexes[bookName][arrayItem[item]] = [];\n-        this.indexes[bookName][arrayItem[item]].push(element); \n-      } else if(\n-        this.indexes[bookName].hasOwnProperty([arrayItem[item]]) && \n-        this.indexes[bookName][arrayItem[item]].indexOf(element) === -1) {\n-        this.indexes[bookName][arrayItem[item]].push(element);\n+  tokenizeFile(file) {\n+    const fileContent = [];\n+    for (let i = 0; i < file.length; i += 1) {\n+      if (file[i].title && file[i].text) {\n+        const text = `${file[i].title} ${file[i].text}`;\n+        const fileDoc = this.textToArray(text);\n+        fileContent.push(fileDoc);\n       }\n     }\n+    return fileContent;\n   }\n \n   /**\n-   * reads the content of a json file and returns false if the file is empty or \n-   * returns true if there are documents in the file.\n-   * @param {Array} book the content of the book\n+   * checks the content of the uploaded json file and returns\n+   * true if the file follows the allowed format\n+   * @param {Array} file the content of the file\n    * @returns {boolean} returns a boolean\n-   * \n    */\n-  readBookData(book) {\n-    if(book.length < 1) {\n+  checkBookData(file) {\n+    if (!Array.isArray(file) || file.length < 1) {\n       return false;\n-    } else {\n-      return true;\n+    }\n+    for (let i = 0; i < file.length; i += 1) {\n+      if (!file[i].title || !file[i].text) {\n+        return false;\n+      }\n+    }\n+    return true;\n+  }\n+\n+  /**\n+   * loops through an array and removes duplicate elements\n+   * @param {}","path":"build/js/inverted-index.js","position":79,"original_position":79,"commit_id":"2940aa4bfa42aaca9feccddd8a805d4a2db5f62e","original_commit_id":"2940aa4bfa42aaca9feccddd8a805d4a2db5f62e","user":{"login":"andela-efortune","id":12124618,"avatar_url":"https://avatars.githubusercontent.com/u/12124618?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-efortune","html_url":"https://github.com/andela-efortune","followers_url":"https://api.github.com/users/andela-efortune/followers","following_url":"https://api.github.com/users/andela-efortune/following{/other_user}","gists_url":"https://api.github.com/users/andela-efortune/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-efortune/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-efortune/subscriptions","organizations_url":"https://api.github.com/users/andela-efortune/orgs","repos_url":"https://api.github.com/users/andela-efortune/repos","events_url":"https://api.github.com/users/andela-efortune/events{/privacy}","received_events_url":"https://api.github.com/users/andela-efortune/received_events","type":"User","site_admin":false},"body":"Specify your param with descriptions accordingly","created_at":"2016-12-06T22:49:39Z","updated_at":"2016-12-06T22:57:00Z","html_url":"https://github.com/andela-vnwaiwu/inverted-index/pull/6#discussion_r91190635","pull_request_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/comments/91190635"},"html":{"href":"https://github.com/andela-vnwaiwu/inverted-index/pull/6#discussion_r91190635"},"pull_request":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/6","id":96449438,"html_url":"https://github.com/andela-vnwaiwu/inverted-index/pull/6","diff_url":"https://github.com/andela-vnwaiwu/inverted-index/pull/6.diff","patch_url":"https://github.com/andela-vnwaiwu/inverted-index/pull/6.patch","issue_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues/6","number":6,"state":"closed","locked":false,"title":"Code Climate Integration","user":{"login":"andela-vnwaiwu","id":21035558,"avatar_url":"https://avatars.githubusercontent.com/u/21035558?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-vnwaiwu","html_url":"https://github.com/andela-vnwaiwu","followers_url":"https://api.github.com/users/andela-vnwaiwu/followers","following_url":"https://api.github.com/users/andela-vnwaiwu/following{/other_user}","gists_url":"https://api.github.com/users/andela-vnwaiwu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-vnwaiwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-vnwaiwu/subscriptions","organizations_url":"https://api.github.com/users/andela-vnwaiwu/orgs","repos_url":"https://api.github.com/users/andela-vnwaiwu/repos","events_url":"https://api.github.com/users/andela-vnwaiwu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-vnwaiwu/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\nIntegrate code climate into the application\r\n#### Description of Task to be completed?\r\nIntegrate code climate with the application\r\n#### How should this be manually tested?\r\nThis can be manually tested by the code climate badge that is found un the readme file\r\n#### Any background context you want to provide?\r\n No background context\r\n#### What are the relevant pivotal tracker stories?\r\nAdd code climate to the application\r\n#### Screenshots (if appropriate)\r\nNot applicable\r\n#### Questions:\r\nNo question","created_at":"2016-12-04T22:20:39Z","updated_at":"2016-12-06T22:57:00Z","closed_at":"2016-12-04T22:21:10Z","merged_at":"2016-12-04T22:21:10Z","merge_commit_sha":"20ebcaa0b60fb8de95f9cc9b4d580267be9816c4","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/6/commits","review_comments_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/6/comments","review_comment_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues/6/comments","statuses_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/statuses/2940aa4bfa42aaca9feccddd8a805d4a2db5f62e","head":{"label":"andela-vnwaiwu:refactor-class","ref":"refactor-class","sha":"2940aa4bfa42aaca9feccddd8a805d4a2db5f62e","user":{"login":"andela-vnwaiwu","id":21035558,"avatar_url":"https://avatars.githubusercontent.com/u/21035558?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-vnwaiwu","html_url":"https://github.com/andela-vnwaiwu","followers_url":"https://api.github.com/users/andela-vnwaiwu/followers","following_url":"https://api.github.com/users/andela-vnwaiwu/following{/other_user}","gists_url":"https://api.github.com/users/andela-vnwaiwu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-vnwaiwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-vnwaiwu/subscriptions","organizations_url":"https://api.github.com/users/andela-vnwaiwu/orgs","repos_url":"https://api.github.com/users/andela-vnwaiwu/repos","events_url":"https://api.github.com/users/andela-vnwaiwu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-vnwaiwu/received_events","type":"User","site_admin":false},"repo":{"id":74562157,"name":"inverted-index","full_name":"andela-vnwaiwu/inverted-index","owner":{"login":"andela-vnwaiwu","id":21035558,"avatar_url":"https://avatars.githubusercontent.com/u/21035558?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-vnwaiwu","html_url":"https://github.com/andela-vnwaiwu","followers_url":"https://api.github.com/users/andela-vnwaiwu/followers","following_url":"https://api.github.com/users/andela-vnwaiwu/following{/other_user}","gists_url":"https://api.github.com/users/andela-vnwaiwu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-vnwaiwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-vnwaiwu/subscriptions","organizations_url":"https://api.github.com/users/andela-vnwaiwu/orgs","repos_url":"https://api.github.com/users/andela-vnwaiwu/repos","events_url":"https://api.github.com/users/andela-vnwaiwu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-vnwaiwu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-vnwaiwu/inverted-index","description":"A git repository for andela Checkpoint 1","fork":false,"url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index","forks_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/forks","keys_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/teams","hooks_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/hooks","issue_events_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues/events{/number}","events_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/events","assignees_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/assignees{/user}","branches_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/branches{/branch}","tags_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/tags","blobs_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/languages","stargazers_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/stargazers","contributors_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/contributors","subscribers_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/subscribers","subscription_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/subscription","commits_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/contents/{+path}","compare_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/merges","archive_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/downloads","issues_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues{/number}","pulls_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/labels{/name}","releases_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/releases{/id}","deployments_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/deployments","created_at":"2016-11-23T09:39:53Z","updated_at":"2016-11-23T11:33:51Z","pushed_at":"2016-12-06T22:06:06Z","git_url":"git://github.com/andela-vnwaiwu/inverted-index.git","ssh_url":"git@github.com:andela-vnwaiwu/inverted-index.git","clone_url":"https://github.com/andela-vnwaiwu/inverted-index.git","svn_url":"https://github.com/andela-vnwaiwu/inverted-index","homepage":null,"size":2079,"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":"develop"}},"base":{"label":"andela-vnwaiwu:develop","ref":"develop","sha":"9830179f4c9fc2b39a199e5b9cf4f5b07659f407","user":{"login":"andela-vnwaiwu","id":21035558,"avatar_url":"https://avatars.githubusercontent.com/u/21035558?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-vnwaiwu","html_url":"https://github.com/andela-vnwaiwu","followers_url":"https://api.github.com/users/andela-vnwaiwu/followers","following_url":"https://api.github.com/users/andela-vnwaiwu/following{/other_user}","gists_url":"https://api.github.com/users/andela-vnwaiwu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-vnwaiwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-vnwaiwu/subscriptions","organizations_url":"https://api.github.com/users/andela-vnwaiwu/orgs","repos_url":"https://api.github.com/users/andela-vnwaiwu/repos","events_url":"https://api.github.com/users/andela-vnwaiwu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-vnwaiwu/received_events","type":"User","site_admin":false},"repo":{"id":74562157,"name":"inverted-index","full_name":"andela-vnwaiwu/inverted-index","owner":{"login":"andela-vnwaiwu","id":21035558,"avatar_url":"https://avatars.githubusercontent.com/u/21035558?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-vnwaiwu","html_url":"https://github.com/andela-vnwaiwu","followers_url":"https://api.github.com/users/andela-vnwaiwu/followers","following_url":"https://api.github.com/users/andela-vnwaiwu/following{/other_user}","gists_url":"https://api.github.com/users/andela-vnwaiwu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-vnwaiwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-vnwaiwu/subscriptions","organizations_url":"https://api.github.com/users/andela-vnwaiwu/orgs","repos_url":"https://api.github.com/users/andela-vnwaiwu/repos","events_url":"https://api.github.com/users/andela-vnwaiwu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-vnwaiwu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-vnwaiwu/inverted-index","description":"A git repository for andela Checkpoint 1","fork":false,"url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index","forks_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/forks","keys_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/teams","hooks_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/hooks","issue_events_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues/events{/number}","events_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/events","assignees_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/assignees{/user}","branches_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/branches{/branch}","tags_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/tags","blobs_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/languages","stargazers_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/stargazers","contributors_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/contributors","subscribers_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/subscribers","subscription_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/subscription","commits_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/contents/{+path}","compare_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/merges","archive_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/downloads","issues_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues{/number}","pulls_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/labels{/name}","releases_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/releases{/id}","deployments_url":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/deployments","created_at":"2016-11-23T09:39:53Z","updated_at":"2016-11-23T11:33:51Z","pushed_at":"2016-12-06T22:06:06Z","git_url":"git://github.com/andela-vnwaiwu/inverted-index.git","ssh_url":"git@github.com:andela-vnwaiwu/inverted-index.git","clone_url":"https://github.com/andela-vnwaiwu/inverted-index.git","svn_url":"https://github.com/andela-vnwaiwu/inverted-index","homepage":null,"size":2079,"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":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/6"},"html":{"href":"https://github.com/andela-vnwaiwu/inverted-index/pull/6"},"issue":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues/6"},"comments":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/andela-vnwaiwu/inverted-index/statuses/2940aa4bfa42aaca9feccddd8a805d4a2db5f62e"}}}}
{"actor":{"display_login":"andela-efortune"}}