code: function (formatString, mapping) {
      var len = formatString.length;
      var i = 0;
      var startIndex = -1;
      var lastChar = null;
      var currentChar = "";
      var resultString = "";
  
      for (; i < len; i++) {
        currentChar = formatString.charAt(i);
  
        if (lastChar === null || lastChar !== currentChar) {
          // change detected
          resultString = _appendMappedString(formatString, mapping, startIndex, i, resultString);
  
          startIndex = i;
        }
  
        lastChar = currentChar;
      }
  
      return _appendMappedString(formatString, mapping, startIndex, i, resultString);
    }
docs: Translates the java date format String to a momentjs format String.
  
  @function translateFormat
  @param {String}  formatString    The unmodified format string
  @param {Object}  mapping         The date format mapping object
  @returns {String}