build/bundle.js
/**
   *
   *
   * @param {Array} validatedFileContent - contents of a valid JSON file
   * @param {String} fileName - name of the file
   * @returns{Object} this.indexedFiles -
   *  contains filenames title and indices of words in the file.
   *
   * @memberOf InvertedIndex
   */
@param {Array} validatedFileContent - contents of a valid JSON file
@param {String} fileName - name of the file
@returns{Object} this.indexedFiles
contains filenames title and indices of words in the file.


@param { Array } validatedFileContent - contents of a valid JSON file @param { String } fileName - name of the file @returns { Object } this . indexedFiles contains filenames title and indices of words in the file .
createIndex(validatedFileContent, fileName) {
    const indices = {};
    const documentWords = {};
    validatedFileContent.forEach((document, key) => {
      const concatenatedText = `${document.title} ${document.text}`;
      const text = InvertedIndex.removeBadCharacters(concatenatedText);
      documentWords[key] = InvertedIndex.tokenizeText(text);
    });
    Object.keys(documentWords).forEach((keys) => {
      documentWords[keys].forEach((word) => {
        if (!Object.prototype.hasOwnProperty.call(indices, word)) {
          indices[word] = [Number(keys)];
        } else { indices[word].push(Number(keys)); }
      });
    });
    this.indexedFiles[fileName] = indices;
    return this.indexedFiles;
  }
createIndex ( validatedFileContent , fileName ) { const indices = { } ; const documentWords = { } ; validatedFileContent . forEach ( ( document , key ) => { const concatenatedText = ` ${ document . title } ${ document . text } ` ; const text = InvertedIndex . removeBadCharacters ( concatenatedText ) ; documentWords [ key ] = InvertedIndex . tokenizeText ( text ) ; } ) ; Object . keys ( documentWords ) . forEach ( ( keys ) => { documentWords [ keys ] . forEach ( ( word ) => { if ( ! Object . prototype . hasOwnProperty . call ( indices , word ) ) { indices [ word ] = [ Number ( keys ) ] ; } else { indices [ word ] . push ( Number ( keys ) ) ; } } ) ; } ) ; this . indexedFiles [ fileName ] = indices ; return this . indexedFiles ; }
@param {Array} validatedFileContent - contents of a valid JSON file
 @param {String} fileName - name of the file
 @returns{Object} this.indexedFiles
  contains filenames title and indices of words in the file.
@param { Array } validatedFileContent - contents of a valid JSON file @param { String } fileName - name of the file @returns { Object } this . indexedFiles contains filenames title and indices of words in the file .