dist/utils.js
function convertAddresses() {
  var addresses = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var uniqueList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

  var values = [];[].concat(addresses).forEach(function (address) {
    if (address.address) {
      address.address = address.address.replace(/^.*?(?=@)/, function (user) {
        return (0, _emailjsMimeCodec.mimeWordsEncode)(user, 'Q');
      }).replace(/@.+$/, function (domain) {
        return '@' + (0, _punycode.toASCII)(domain.substr(1));
      });

      if (!address.name) {
        values.push(address.address);
      } else if (address.name) {
        values.push(encodeAddressName(address.name) + ' <' + address.address + '>');
      }

      if (uniqueList.indexOf(address.address) < 0) {
        uniqueList.push(address.address);
      }
    } else if (address.group) {
      values.push(encodeAddressName(address.name) + ':' + (address.group.length ? convertAddresses(address.group, uniqueList) : '').trim() + ';');
    }
  });

  return values.join(', ');
}
function convertAddresses() {
  var addresses = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var uniqueList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];

  var values = [];[].concat(addresses).forEach(function (address) {
    if (address.address) {
      address.address = address.address.replace(/^.*?(?=@)/, function (user) {
        return (0, _emailjsMimeCodec.mimeWordsEncode)(user, 'Q');
      }).replace(/@.+$/, function (domain) {
        return '@' + (0, _punycode.toASCII)(domain.substr(1));
      });

      if (!address.name) {
        values.push(address.address);
      } else if (address.name) {
        values.push(encodeAddressName(address.name) + ' <' + address.address + '>');
      }

      if (uniqueList.indexOf(address.address) < 0) {
        uniqueList.push(address.address);
      }
    } else if (address.group) {
      values.push(encodeAddressName(address.name) + ':' + (address.group.length ? convertAddresses(address.group, uniqueList) : '').trim() + ';');
    }
  });

  return values.join(', ');
}
function convertAddresses ( ) { var addresses = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : [ ] ; var uniqueList = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : [ ] ; var values = [ ] ; [ ] . concat ( addresses ) . forEach ( function ( address ) { if ( address . address ) { address . address = address . address . replace ( / ^.*?(?=@) / , function ( user ) { return ( 0 , _emailjsMimeCodec . mimeWordsEncode ) ( user , 'Q' ) ; } ) . replace ( / @.+$ / , function ( domain ) { return '@' + ( 0 , _punycode . toASCII ) ( domain . substr ( 1 ) ) ; } ) ; if ( ! address . name ) { values . push ( address . address ) ; } else if ( address . name ) { values . push ( encodeAddressName ( address . name ) + ' <' + address . address + '>' ) ; } if ( uniqueList . indexOf ( address . address ) < 0 ) { uniqueList . push ( address . address ) ; } } else if ( address . group ) { values . push ( encodeAddressName ( address . name ) + ':' + ( address . group . length ? convertAddresses ( address . group , uniqueList ) : '' ) . trim ( ) + ';' ) ; } } ) ; return values . join ( ', ' ) ; }
Rebuilds address object using punycode and other adjustments

@param {Array} addresses An array of address objects
@param {Array} [uniqueList] An array to be populated with addresses
@return {String} address string
Rebuilds address object using punycode and other adjustments