code: function applyReplacements(str, replacements) {
      var result = "",
          replacement,
          i;
  
      for (i = 0; i < replacements.length; i++) {
          replacement = replacements[i];
          if (replacement) {
              result += replacement.newStr;
              i += replacement.oldStr.length - 1;
          } else {
              result += str.charAt(i);
          }
      }
  
      result += str.substr(i, str.length);
  
      return result;
  }
docs: Applies all replacements on the given string.
  
  @private
  @param {String} str
  @param {Array<Replacement>} replacements
  @returns {string}