code: function(currentCauses, nextCause, facts, constants, rule) {
          var substitutedNextCauses = [],
              mappings = [];
  
          for (var i = 0; i < currentCauses.length; i++) {
  
              for (var j = 0; j < facts.length; j++) {
  
                  // Get the mapping of the current cause ...
                  var mapping = currentCauses[i].mapping,
                      substitutedNextCause,
                      newMapping;
                  // ... or build a fresh one if it does not exist
                  if (mapping === undefined) {
                      mapping = {};
                      mapping.__facts__ = [];
                  }
  
                  // Update the mapping using pattern matching
                  newMapping = this.factMatches(facts[j], currentCauses[i], mapping, constants, rule);
  
                  // If the current fact matches the current cause ...
                  if (newMapping) {
                      // If there are other causes to be checked...
                      if (nextCause) {
                          // Substitute the next cause's variable with the new mapping
                          substitutedNextCause = this.substituteFactVariables(newMapping, nextCause);
                          substitutedNextCause.mapping = newMapping;
                          substitutedNextCauses.push(substitutedNextCause);
                      } else {
                          // Otherwise, add the new mapping to the global mapping array
                          mappings.push(newMapping);
                      }
                  }
              }
          }
  
          if(nextCause) {
              return substitutedNextCauses;
          } else {
              return mappings;
          }
      }
docs: Updates the mapping of the current cause
  given the next cause of a rule, over a
  set of facts.
  @param currentCauses
  @param nextCause
  @param facts
  @returns {Array}