static isSameConnection(element, object) {
    if (Array.isArray(object.clusters) && object.clusters.length > 0) {
      // clusters list may not contain ALL cluster nodes, only some
      // now check booth lists to check if there is AT LEAST on matching hostname/ip
      // => it must be the same connection then
      if (Array.isArray(element.clusters) && element.clusters.length > 0) {
        const found = object.clusters.find(function(oItem) {
          const found2 = element.clusters.find(function(eItem) {
            if (oItem.host.toLowerCase() === eItem.host.toLowerCase() && oItem.port == eItem.port) {
              if (typeof element.dbIndex !== 'undefined' && element.dbIndex == object.dbIndex) {
                return true;
              }
              else {
                return (typeof element.db !== 'undefined' && element.db == object.dbIndex);
              }
            }
            return false;
          });
          return typeof found2 !== 'undefined';
        });
        if (found) return true;
      }
      // second try - if host and isCluster is set this one might be converted to clusters[] right now
      // check base connections without cluster for same host/port
      if (object.isCluster === true && element.host === object.host && element.port === object.port) {
        return true;
      }
      return false;
    }
    else if (Array.isArray(object.sentinels) && object.sentinels.length > 0) {
      // sentinel comparison is similar to cluster one except it has additional important name property
      // sentinels list may not contain ALL sentinels, only some
      // now check booth lists to check if there is AT LEAST on matching hostname/ip
      // => it must be the same connection then
      if (Array.isArray(element.sentinels) && element.sentinels.length > 0) {
        // our config names it "sentinelName", ioredis stores it at more general "name" properties
        // attribute used depends on if this is a config item or an existing redis client
        const oName = (object.sentinelName ? object.sentinelName : object.name);
        const eName = (element.sentinelName ? element.sentinelName : element.name);
        if (eName.toLowerCase() === oName.toLowerCase()) {
          const found = object.sentinels.find(function(oItem) {
            const found2 = element.sentinels.find(function(eItem) {
              if (oItem.host.toLowerCase() === eItem.host.toLowerCase() && oItem.port == eItem.port) {
                if (typeof element.dbIndex !== 'undefined' && element.dbIndex == object.dbIndex) {
                  return true;
                }
                else {
                  return (typeof element.db !== 'undefined' && element.db == object.dbIndex);
                }
              }
              return false;
            });
            return typeof found2 !== 'undefined';
          });
          if (found) return true;
        }
      }
      return false;
    }
    else if (object.host) {
      if (element.host === object.host && element.port == object.port) {
        // dbIndex for configuration item
        // db for ioredis client options object
        if ((typeof element.dbIndex !== 'undefined' && element.dbIndex == object.dbIndex) ||
          (typeof element.db !== 'undefined' && element.db == object.dbIndex)) {
          return true;
        }
      }
    }
    else if (object.path && element.path === object.path) {
      if ((typeof element.dbIndex !== 'undefined' && element.dbIndex == object.dbIndex) ||
        (typeof element.db !== 'undefined' && element.db == object.dbIndex)) {
        return true;
      }
    }
    return false;
  }
This method compares two redis connection objects if they refer to the same server connection.
 Only fields needed to create the network/socket connection are compared.

 Compared are the following fields only:
 <ul>
   <li> db or dbIndex </li>
   <li> sentinels list - at least one host:port entry must match together with the sentinelName </li>
   <li> clusters list  - at least one host:port entry must match </li>
   <li> host and port </li>
   <li> path </li>
 </ul>
 Not compared are the following fields like: password, tls, connectionName, label, connectionId

 @param {object} element first connection object for comparison
 @param {object} object second connection object for comparison
 @return {boolean} true if same connection is found
 @private