docs: function foldLine( input, maxLength, hardWrap ) {
  
    if( maxLength != null && maxLength < MIN_LINE_LENGTH ) {
      throw new Error( 'Maximum length must not be less than ' + MIN_LINE_LENGTH )
    }
  
    if( maxLength != null && maxLength > MAX_LINE_LENGTH ) {
      throw new Error( 'Maximum length must not exceed ' + MAX_LINE_LENGTH )
    }
  
    // RFC compliant default line length
    maxLength = maxLength || DEFAULT_LINE_LENGTH
  
    input = input.replace( /[\r\n]+/g, '' )
  
    // We really don't need to fold this
    if( input.length <= maxLength ) {
      return input
    }
  
    var output = ''
    var index = 0
    var nextIndex = 0
    var length = input.length
    var line = 0
    var trim = 0
  
    while( index < length ) {
      if( !hardWrap && ~( nextIndex = input.lastIndexOf( SP, index + maxLength ) ) ) {
        if( nextIndex > index ) {
          output += input.slice( index, nextIndex ) + CRLF + SP
          index = nextIndex
        } else {
          output += input.slice( index, index + maxLength - trim ) + CRLF + SP
          index = index + maxLength - trim
          hardWrap = true
        }
      } else {
        output += input.slice( index, index + maxLength - trim ) + CRLF + SP
        index = index + maxLength - trim
      }
      if( ( length - index ) < maxLength ) {
        output += input.slice( index )
        break
      }
      if( line === 0 ) {
        trim = 1
      }
      line++
    }
  
    return output
  
  }