docs: function (array, insertions, substitutions, forceString, maxLength)
          {
              var replacement;
              var count = array.length;
              // Don't even try the split approach for 3 or less elements if the concat approach can
              // be applied.
              if (substitutions || count > 3)
              {
                  var preReplacement =
                  function ()
                  {
                      // Length of the shortest string replacement "([]+[])".
                      var STRING_REPLACEMENT_MIN_LENGTH = 7;
  
                      // This is for the overhead of "[" + "](" + ")" plus the length of the shortest
                      // separator replacement "[]".
                      var SEPARATOR_MIN_OVERHEAD = 6;
  
                      // This is for the overhead of "[" + "](" + ")" plus the length of the shortest
                      // joiner replacement "[]".
                      var JOINER_MIN_OVERHEAD = 6;
  
                      var joinCount = substitutions ? substitutions.length : 0;
                      var splitCount = joinCount + 1;
                      var maxSplitReplacementLength =
                      (maxLength - STRING_REPLACEMENT_MIN_LENGTH) / splitCount -
                      SEPARATOR_MIN_OVERHEAD;
                      var splitReplacement =
                      this.replaceString
                      ('split', { maxLength: maxSplitReplacementLength, optimize: true });
                      if (!splitReplacement)
                          return;
                      var preReplacement = '';
                      if (joinCount)
                      {
                          var maxJoinReplacementLength =
                          (
                              maxLength - STRING_REPLACEMENT_MIN_LENGTH -
                              splitCount * (splitReplacement.length + SEPARATOR_MIN_OVERHEAD)
                          ) /
                          joinCount -
                          JOINER_MIN_OVERHEAD;
                          var joinReplacement =
                          this.replaceString('join', { maxLength: maxJoinReplacementLength });
                          if (!joinReplacement)
                              return;
                          substitutions.forEach
                          (
                              function (substitution)
                              {
                                  var separatorReplacement =
                                  undefinedAsString(this.replaceExpr(substitution.separator));
                                  var joinerReplacement =
                                  undefinedAsString(this.replaceString(substitution.joiner));
                                  preReplacement +=
                                  '[' + splitReplacement + '](' + separatorReplacement + ')[' +
                                  joinReplacement + '](' + joinerReplacement + ')';
                              },
                              this
                          );
                      }
                      preReplacement += '[' + splitReplacement + ']';
                      return preReplacement;
                  }
                  .call(this);
              }
              if (!substitutions && count > 1)
              {
                  var concatReplacement =
                  this.replaceString('concat', { maxLength: maxLength, optimize: true });
              }
              if (preReplacement)
              // Approach 1: (array[0] + joiner + array[1] + joiner + array[2]...).split(separator)
              {
                  // 2 is for the additional overhead of "(" + ")".
                  var maxBulkLength = maxLength - (preReplacement.length + 2);
                  var optimalStrReplacement;
                  var optimalSeparatorReplacement;
                  insertions.forEach
                  (
                      function (insertion)
                      {
                          var str = array.join(insertion.joiner);
                          var strReplacement = this.replaceJoinedArrayString(str, maxBulkLength);
                          if (!strReplacement)
                              return;
                          var separatorReplacement =
                          undefinedAsString(this.replaceExpr(insertion.separator));
                          var bulkLength = strReplacement.length + separatorReplacement.length;
                          if (!(bulkLength > maxBulkLength))
                          {
                              maxBulkLength = bulkLength;
                              optimalStrReplacement = strReplacement;
                              optimalSeparatorReplacement = separatorReplacement;
                          }
                      },
                      this
                  );
                  if (optimalStrReplacement)
                  {
                      replacement =
                      optimalStrReplacement + preReplacement + '(' + optimalSeparatorReplacement +
                      ')';
                      maxLength = replacement.length - 1;
                  }
              }
              if
              (
                  !substitutions &&
                  (
                      count <= 1 ||
                      concatReplacement &&
                      // 4 is the length of the shortest possible replacement "[[]]".
                      // 7 is the length of the shortest possible additional overhead for each
                      // following array element, as in "[" + "](+[])" or "[" + "](![])".
                      !(4 + (concatReplacement.length + 7) * (count - 1) > maxLength)
                  )
              )
              // Approach 2: [array[0]].concat(array[1]).concat(array[2])...
              {
                  var arrayReplacement;
                  var options = { forceString: forceString };
                  if
                  (
                      !array.some
                      (
                          function (element)
                          {
                              var elementReplacement =
                              undefinedAsString(replaceStaticString(element, options));
                              if (arrayReplacement)
                              {
                                  if (elementReplacement === '[]')
                                      elementReplacement = '[[]]';
                                  arrayReplacement +=
                                  '[' + concatReplacement + '](' + elementReplacement + ')';
                              }
                              else
                                  arrayReplacement = '[' + elementReplacement + ']';
                              var result = arrayReplacement.length > maxLength;
                              return result;
                          }
                      )
                  )
                      replacement = arrayReplacement;
              }
              return replacement;
          }