dist/jst9.js
function _exploreBranch(baseWord, currentBranch) {
    var predictedList = [];

    for (var b in currentBranch.branches) { //For each branch forking from the branch
      var prefix = currentBranch.branches[b].prefix; //Get the leading character of the current branch

      if (currentBranch.branches[b].$ === true) { //If the current leaf ends a word, puts the word on the list
        predictedList.push(baseWord + prefix);
      }

      //Recursively calls the function, passing the forking branches as parameter
      var predictedWords = this._exploreBranch(baseWord + prefix, currentBranch.branches[b]);

      predictedList = predictedList.concat(predictedWords);

    }
    return predictedList;
  }
function _exploreBranch(baseWord, currentBranch) {
    var predictedList = [];

    for (var b in currentBranch.branches) { //For each branch forking from the branch
      var prefix = currentBranch.branches[b].prefix; //Get the leading character of the current branch

      if (currentBranch.branches[b].$ === true) { //If the current leaf ends a word, puts the word on the list
        predictedList.push(baseWord + prefix);
      }

      //Recursively calls the function, passing the forking branches as parameter
      var predictedWords = this._exploreBranch(baseWord + prefix, currentBranch.branches[b]);

      predictedList = predictedList.concat(predictedWords);

    }
    return predictedList;
  }
function _exploreBranch ( baseWord , currentBranch ) { var predictedList = [ ] ; for ( var b in currentBranch . branches ) { //For each branch forking from the branch var prefix = currentBranch . branches [ b ] . prefix ; //Get the leading character of the current branch if ( currentBranch . branches [ b ] . $ === true ) { //If the current leaf ends a word, puts the word on the list predictedList . push ( baseWord + prefix ) ; } //Recursively calls the function, passing the forking branches as parameter var predictedWords = this . _exploreBranch ( baseWord + prefix , currentBranch . branches [ b ] ) ; predictedList = predictedList . concat ( predictedWords ) ; } return predictedList ; }
Looks for the words that contain the word passed as parameter
@param  {String} baseWord The base to look for
@param  {Object} currentBranch   The begining branch
@return {Array}          List of predicted words
Looks for the words that contain the word passed as parameter