{"action":"created","comment":{"url":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/comments/90173785","pull_request_review_id":10695925,"id":90173785,"diff_hunk":"@@ -0,0 +1,241 @@\n+'use strict';\n+\n+var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n+\n+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n+\n+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n+\n+/**\n+* remove array duplicates.\n+* @param {array} arr - The array to be filtered.\n+* @returns {array} The filtered array.\n+*/\n+var unique = function unique(arr) {\n+  var checked = {};\n+  return arr.filter(function (x) {\n+    if (!checked[x]) {\n+      checked[x] = true;\n+      return x;\n+    }\n+    return null;\n+  });\n+};\n+\n+/**\n+* JSON file reader.\n+* @param {string} url - The url of JSON file.\n+* @param {function} callback - the callback function.\n+* @returns {object} The promised object.\n+*/\n+var getJSON = function getJSON(url, callback) {\n+  return new Promise(function (resolve, reject) {\n+    var xhr = new XMLHttpRequest();\n+    xhr.open('GET', url, true);\n+    xhr.send();\n+    xhr.onreadystatechange = function changed() {\n+      if (this.readyState === 4 && this.status === 200) {\n+        resolve(callback(this));\n+      }\n+    };\n+    xhr.onerror = reject;\n+  });\n+};\n+\n+/**\n+* check if object follows allowed structure.\n+* @param {object} collection - The JSON file content.\n+* @returns {boolean} The check for collection validity.\n+*/\n+var isValidObject = function isValidObject(collection) {\n+  var i = 0;\n+  while (i < collection.length) {\n+    var hasValidTitle = collection[i].title !== undefined && collection[i].title.length > 0 && typeof collection[i].title === 'string';\n+    var hasValidText = collection[i].text !== undefined && collection[i].text.length > 0 && typeof collection[i].text === 'string';\n+    if (!(hasValidText && hasValidTitle)) {\n+      return false;\n+    }\n+    i += 1;\n+  }\n+  return true;\n+};\n+\n+/**\n+* test if json file is valid.\n+* @param {string} str - The JSON string.\n+* @returns {object} The json file.\n+*/\n+var isJSON = function isJSON(str) {\n+  var json = JSON.parse(str);\n+  if (isValidObject(json)) {\n+    return json;\n+  }\n+  return 'json file is not formatted properly';\n+};\n+\n+/**\n+* save file and sort docs in json.\n+* @param {object} xhr - xml-http-req response object.\n+* @returns {array} The tokens docs and words in file.\n+*/\n+var saveTokens = function saveTokens(xhr) {\n+  var docs = isJSON(xhr.responseText);\n+  var tokens = {};\n+  var words = [];\n+  docs.forEach(function (document, index) {\n+    var token = '';\n+    token = document.title + ' ' + document.text;\n+    var uniqueTokens = unique(token.toLowerCase().match(/\\w+/g).sort());\n+    tokens[index] = uniqueTokens;\n+    words = words.concat(uniqueTokens);\n+  });\n+  return [tokens, docs, words];\n+};\n+\n+/**\n+* format file name to acceptable format.\n+* @param {string} name - the current file url.\n+* @returns {string} The new valid file name.\n+*/\n+var formatFileName = function formatFileName(name) {\n+  var matcher = new RegExp(/\\/\\w+.json/, 'gi');\n+  return matcher.exec(name).toString().slice(1);\n+};\n+\n+/**\n+* populate the object reference attribute.\n+* @param {object} tokenObj - an object representing the data returned on xhr req.\n+* @param {object} parent - the current (this) object.\n+* @param {string} doc - the current file name.\n+* @returns {object} The file indexes.\n+*/\n+var populateReference = function populateReference(tokenObj, parent, doc) {\n+  var tokenObjKeys = Object.keys(tokenObj);\n+  var tokenObjKeysLength = tokenObjKeys.length;\n+  var index = 0;\n+  parent.reference[doc] = {};\n+  var tokenIndex = function tokenIndex() {\n+    tokenObj[index].forEach(function (word) {\n+      parent.reference[doc][word] !== undefined ? parent.reference[doc][word].push(index) : (parent.reference[doc][word] = [], parent.reference[doc][word].push(index));\n+    });\n+    index += 1;\n+  };\n+  while (index < tokenObjKeysLength) {\n+    tokenIndex();\n+  }\n+  return parent.reference[doc];\n+};\n+\n+/** populate our document repository\n+* @param {object} tokenObj - an object representing the data returned on xhr req.\n+* @param {object} parent - the current (this) object.\n+* @param {string} doc - the current file name.\n+* @returns {obj} The reference object for current file.\n+*/\n+var populateDocFiles = function populateDocFiles(tokenObj, parent, doc) {\n+  parent.docFiles[doc] = tokenObj;\n+  return parent.docFiles[doc];\n+};\n+\n+/** filter text input\n+* @param {string} value - the current search query(array or string).\n+* @returns {array} The filtered search query.\n+*/\n+var inputFIlter = function inputFIlter(value) {\n+  return value.replace(/[^\\w\\s]/gi, '').split(' ').filter(function (item) {\n+    return (/\\S/gi.test(item)\n+    );\n+  });\n+};\n+\n+/**\n+ * Class for creating an inverted index.\n+ * @extends Point\n+ */\n+\n+var InvertedIndex = function () {\n+  /**\n+  * Instantiate an inverted index object.\n+  * @param {object} reference - The inverted index reference object.\n+  * @param {object} docFiles - The createIndex instance file names.\n+  * @param {array} docFileNames - an array of the url of files indexed.\n+  * @param {array} currentDocs - an array of file names indexed\n+  * @param {array} word - all words from docs in files indexed\n+  */\n+  function InvertedIndex() {","path":"src/public/js/inverted-index.js","position":165,"original_position":165,"commit_id":"90dfad85f7e2dcb45d31609820e10186d515aace","original_commit_id":"90dfad85f7e2dcb45d31609820e10186d515aace","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":"'InvertedIndex' is already declared in the upper scope                   no-shadow","created_at":"2016-11-30T06:06:56Z","updated_at":"2016-11-30T06:06:56Z","html_url":"https://github.com/andela-venogwe/inverted-index/pull/14#discussion_r90173785","pull_request_url":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/comments/90173785"},"html":{"href":"https://github.com/andela-venogwe/inverted-index/pull/14#discussion_r90173785"},"pull_request":{"href":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/14","id":94747851,"html_url":"https://github.com/andela-venogwe/inverted-index/pull/14","diff_url":"https://github.com/andela-venogwe/inverted-index/pull/14.diff","patch_url":"https://github.com/andela-venogwe/inverted-index/pull/14.patch","issue_url":"https://api.github.com/repos/andela-venogwe/inverted-index/issues/14","number":14,"state":"open","locked":false,"title":"chore(Hound ci) code coverage fix","user":{"login":"andela-venogwe","id":23452630,"avatar_url":"https://avatars.githubusercontent.com/u/23452630?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-venogwe","html_url":"https://github.com/andela-venogwe","followers_url":"https://api.github.com/users/andela-venogwe/followers","following_url":"https://api.github.com/users/andela-venogwe/following{/other_user}","gists_url":"https://api.github.com/users/andela-venogwe/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-venogwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-venogwe/subscriptions","organizations_url":"https://api.github.com/users/andela-venogwe/orgs","repos_url":"https://api.github.com/users/andela-venogwe/repos","events_url":"https://api.github.com/users/andela-venogwe/events{/privacy}","received_events_url":"https://api.github.com/users/andela-venogwe/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-22T04:49:29Z","updated_at":"2016-11-30T06:06:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"668ccc9e26cd868736217e423ae86108f9cb56be","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/14/commits","review_comments_url":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/14/comments","review_comment_url":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela-venogwe/inverted-index/issues/14/comments","statuses_url":"https://api.github.com/repos/andela-venogwe/inverted-index/statuses/90dfad85f7e2dcb45d31609820e10186d515aace","head":{"label":"andela-venogwe:develop","ref":"develop","sha":"90dfad85f7e2dcb45d31609820e10186d515aace","user":{"login":"andela-venogwe","id":23452630,"avatar_url":"https://avatars.githubusercontent.com/u/23452630?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-venogwe","html_url":"https://github.com/andela-venogwe","followers_url":"https://api.github.com/users/andela-venogwe/followers","following_url":"https://api.github.com/users/andela-venogwe/following{/other_user}","gists_url":"https://api.github.com/users/andela-venogwe/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-venogwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-venogwe/subscriptions","organizations_url":"https://api.github.com/users/andela-venogwe/orgs","repos_url":"https://api.github.com/users/andela-venogwe/repos","events_url":"https://api.github.com/users/andela-venogwe/events{/privacy}","received_events_url":"https://api.github.com/users/andela-venogwe/received_events","type":"User","site_admin":false},"repo":{"id":73715261,"name":"inverted-index","full_name":"andela-venogwe/inverted-index","owner":{"login":"andela-venogwe","id":23452630,"avatar_url":"https://avatars.githubusercontent.com/u/23452630?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-venogwe","html_url":"https://github.com/andela-venogwe","followers_url":"https://api.github.com/users/andela-venogwe/followers","following_url":"https://api.github.com/users/andela-venogwe/following{/other_user}","gists_url":"https://api.github.com/users/andela-venogwe/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-venogwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-venogwe/subscriptions","organizations_url":"https://api.github.com/users/andela-venogwe/orgs","repos_url":"https://api.github.com/users/andela-venogwe/repos","events_url":"https://api.github.com/users/andela-venogwe/events{/privacy}","received_events_url":"https://api.github.com/users/andela-venogwe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-venogwe/inverted-index","description":null,"fork":false,"url":"https://api.github.com/repos/andela-venogwe/inverted-index","forks_url":"https://api.github.com/repos/andela-venogwe/inverted-index/forks","keys_url":"https://api.github.com/repos/andela-venogwe/inverted-index/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-venogwe/inverted-index/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-venogwe/inverted-index/teams","hooks_url":"https://api.github.com/repos/andela-venogwe/inverted-index/hooks","issue_events_url":"https://api.github.com/repos/andela-venogwe/inverted-index/issues/events{/number}","events_url":"https://api.github.com/repos/andela-venogwe/inverted-index/events","assignees_url":"https://api.github.com/repos/andela-venogwe/inverted-index/assignees{/user}","branches_url":"https://api.github.com/repos/andela-venogwe/inverted-index/branches{/branch}","tags_url":"https://api.github.com/repos/andela-venogwe/inverted-index/tags","blobs_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-venogwe/inverted-index/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-venogwe/inverted-index/languages","stargazers_url":"https://api.github.com/repos/andela-venogwe/inverted-index/stargazers","contributors_url":"https://api.github.com/repos/andela-venogwe/inverted-index/contributors","subscribers_url":"https://api.github.com/repos/andela-venogwe/inverted-index/subscribers","subscription_url":"https://api.github.com/repos/andela-venogwe/inverted-index/subscription","commits_url":"https://api.github.com/repos/andela-venogwe/inverted-index/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-venogwe/inverted-index/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-venogwe/inverted-index/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-venogwe/inverted-index/contents/{+path}","compare_url":"https://api.github.com/repos/andela-venogwe/inverted-index/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-venogwe/inverted-index/merges","archive_url":"https://api.github.com/repos/andela-venogwe/inverted-index/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-venogwe/inverted-index/downloads","issues_url":"https://api.github.com/repos/andela-venogwe/inverted-index/issues{/number}","pulls_url":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-venogwe/inverted-index/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-venogwe/inverted-index/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-venogwe/inverted-index/labels{/name}","releases_url":"https://api.github.com/repos/andela-venogwe/inverted-index/releases{/id}","deployments_url":"https://api.github.com/repos/andela-venogwe/inverted-index/deployments","created_at":"2016-11-14T14:56:05Z","updated_at":"2016-11-14T14:58:35Z","pushed_at":"2016-11-30T06:06:42Z","git_url":"git://github.com/andela-venogwe/inverted-index.git","ssh_url":"git@github.com:andela-venogwe/inverted-index.git","clone_url":"https://github.com/andela-venogwe/inverted-index.git","svn_url":"https://github.com/andela-venogwe/inverted-index","homepage":null,"size":150,"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-venogwe:staging","ref":"staging","sha":"c8ad9e081744e7c99de7f92da78873720ceabdb4","user":{"login":"andela-venogwe","id":23452630,"avatar_url":"https://avatars.githubusercontent.com/u/23452630?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-venogwe","html_url":"https://github.com/andela-venogwe","followers_url":"https://api.github.com/users/andela-venogwe/followers","following_url":"https://api.github.com/users/andela-venogwe/following{/other_user}","gists_url":"https://api.github.com/users/andela-venogwe/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-venogwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-venogwe/subscriptions","organizations_url":"https://api.github.com/users/andela-venogwe/orgs","repos_url":"https://api.github.com/users/andela-venogwe/repos","events_url":"https://api.github.com/users/andela-venogwe/events{/privacy}","received_events_url":"https://api.github.com/users/andela-venogwe/received_events","type":"User","site_admin":false},"repo":{"id":73715261,"name":"inverted-index","full_name":"andela-venogwe/inverted-index","owner":{"login":"andela-venogwe","id":23452630,"avatar_url":"https://avatars.githubusercontent.com/u/23452630?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-venogwe","html_url":"https://github.com/andela-venogwe","followers_url":"https://api.github.com/users/andela-venogwe/followers","following_url":"https://api.github.com/users/andela-venogwe/following{/other_user}","gists_url":"https://api.github.com/users/andela-venogwe/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-venogwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-venogwe/subscriptions","organizations_url":"https://api.github.com/users/andela-venogwe/orgs","repos_url":"https://api.github.com/users/andela-venogwe/repos","events_url":"https://api.github.com/users/andela-venogwe/events{/privacy}","received_events_url":"https://api.github.com/users/andela-venogwe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andela-venogwe/inverted-index","description":null,"fork":false,"url":"https://api.github.com/repos/andela-venogwe/inverted-index","forks_url":"https://api.github.com/repos/andela-venogwe/inverted-index/forks","keys_url":"https://api.github.com/repos/andela-venogwe/inverted-index/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela-venogwe/inverted-index/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela-venogwe/inverted-index/teams","hooks_url":"https://api.github.com/repos/andela-venogwe/inverted-index/hooks","issue_events_url":"https://api.github.com/repos/andela-venogwe/inverted-index/issues/events{/number}","events_url":"https://api.github.com/repos/andela-venogwe/inverted-index/events","assignees_url":"https://api.github.com/repos/andela-venogwe/inverted-index/assignees{/user}","branches_url":"https://api.github.com/repos/andela-venogwe/inverted-index/branches{/branch}","tags_url":"https://api.github.com/repos/andela-venogwe/inverted-index/tags","blobs_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela-venogwe/inverted-index/statuses/{sha}","languages_url":"https://api.github.com/repos/andela-venogwe/inverted-index/languages","stargazers_url":"https://api.github.com/repos/andela-venogwe/inverted-index/stargazers","contributors_url":"https://api.github.com/repos/andela-venogwe/inverted-index/contributors","subscribers_url":"https://api.github.com/repos/andela-venogwe/inverted-index/subscribers","subscription_url":"https://api.github.com/repos/andela-venogwe/inverted-index/subscription","commits_url":"https://api.github.com/repos/andela-venogwe/inverted-index/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela-venogwe/inverted-index/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela-venogwe/inverted-index/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela-venogwe/inverted-index/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela-venogwe/inverted-index/contents/{+path}","compare_url":"https://api.github.com/repos/andela-venogwe/inverted-index/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela-venogwe/inverted-index/merges","archive_url":"https://api.github.com/repos/andela-venogwe/inverted-index/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela-venogwe/inverted-index/downloads","issues_url":"https://api.github.com/repos/andela-venogwe/inverted-index/issues{/number}","pulls_url":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls{/number}","milestones_url":"https://api.github.com/repos/andela-venogwe/inverted-index/milestones{/number}","notifications_url":"https://api.github.com/repos/andela-venogwe/inverted-index/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela-venogwe/inverted-index/labels{/name}","releases_url":"https://api.github.com/repos/andela-venogwe/inverted-index/releases{/id}","deployments_url":"https://api.github.com/repos/andela-venogwe/inverted-index/deployments","created_at":"2016-11-14T14:56:05Z","updated_at":"2016-11-14T14:58:35Z","pushed_at":"2016-11-30T06:06:42Z","git_url":"git://github.com/andela-venogwe/inverted-index.git","ssh_url":"git@github.com:andela-venogwe/inverted-index.git","clone_url":"https://github.com/andela-venogwe/inverted-index.git","svn_url":"https://github.com/andela-venogwe/inverted-index","homepage":null,"size":150,"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-venogwe/inverted-index/pulls/14"},"html":{"href":"https://github.com/andela-venogwe/inverted-index/pull/14"},"issue":{"href":"https://api.github.com/repos/andela-venogwe/inverted-index/issues/14"},"comments":{"href":"https://api.github.com/repos/andela-venogwe/inverted-index/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela-venogwe/inverted-index/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/andela-venogwe/inverted-index/statuses/90dfad85f7e2dcb45d31609820e10186d515aace"}}}}
{"actor":{"display_login":"houndci-bot"}}