function sibling(node, selector, ancestry, side) {
    const parent = ancestry[0];
    if (!parent) {
      return false;
    }
    const keys = Object.keys(parent);
    for (let i = 0; i < keys.length; ++i) {
      const listProp = parent[keys[i]];
      if (Array.isArray(listProp)) {
        const startIndex = listProp.indexOf(node);
        if (startIndex < 0) {
          continue;
        }

        let lowerBound;
        let upperBound;
        if (side === LEFT_SIDE) {
          lowerBound = 0;
          upperBound = startIndex;
        } else {
          lowerBound = startIndex + 1;
          upperBound = listProp.length;
        }

        for (let k = lowerBound; k < upperBound; ++k) {
          if (matches(listProp[k], selector, ancestry)) {
            return true;
          }
        }
      }
    }
    return false;
  }
/*
   * Determines if the given node has a sibling that matches the given selector.
   */
Determines if the given node has a sibling that matches the given selector.
Determines if the given node has a sibling that matches the given selector .
function sibling(node, selector, ancestry, side) {
    const parent = ancestry[0];
    if (!parent) {
      return false;
    }
    const keys = Object.keys(parent);
    for (let i = 0; i < keys.length; ++i) {
      const listProp = parent[keys[i]];
      if (Array.isArray(listProp)) {
        const startIndex = listProp.indexOf(node);
        if (startIndex < 0) {
          continue;
        }
        let lowerBound;
        let upperBound;
        if (side === LEFT_SIDE) {
          lowerBound = 0;
          upperBound = startIndex;
        } else {
          lowerBound = startIndex + 1;
          upperBound = listProp.length;
        }
        for (let k = lowerBound; k < upperBound; ++k) {
          if (matches(listProp[k], selector, ancestry)) {
            return true;
          }
        }
      }
    }
    return false;
  }
function sibling ( node , selector , ancestry , side ) { const parent = ancestry [ 0 ] ; if ( ! parent ) { return false ; } const keys = Object . keys ( parent ) ; for ( let i = 0 ; i < keys . length ; ++ i ) { const listProp = parent [ keys [ i ] ] ; if ( Array . isArray ( listProp ) ) { const startIndex = listProp . indexOf ( node ) ; if ( startIndex < 0 ) { continue ; } let lowerBound ; let upperBound ; if ( side === LEFT_SIDE ) { lowerBound = 0 ; upperBound = startIndex ; } else { lowerBound = startIndex + 1 ; upperBound = listProp . length ; } for ( let k = lowerBound ; k < upperBound ; ++ k ) { if ( matches ( listProp [ k ] , selector , ancestry ) ) { return true ; } } } } return false ; }
Determines if the given node has a sibling that matches the given selector.
Determines if the given node has a sibling that matches the given selector .