function equal(c, d) {
  const seen = new Map();
  return (function compare(a, b) {
    // Have to render RegExp & Date for string comparison
    // unless it's mistreated as object
    if (
      a && b &&
      (a instanceof RegExp && b instanceof RegExp ||
        a instanceof URL && b instanceof URL)
    ) {
      return String(a) === String(b);
    }
    if (a instanceof Date && b instanceof Date) {
      const aTime = a.getTime();
      const bTime = b.getTime();
      // Check for NaN equality manually since NaN is not
      // equal to itself.
      if (Number.isNaN(aTime) && Number.isNaN(bTime)) {
        return true;
      }
      return a.getTime() === b.getTime();
    }
    if (Object.is(a, b)) {
      return true;
    }
    if (a && typeof a === "object" && b && typeof b === "object") {
      if (seen.get(a) === b) {
        return true;
      }
      if (Object.keys(a || {}).length !== Object.keys(b || {}).length) {
        return false;
      }
      if (isKeyedCollection(a) && isKeyedCollection(b)) {
        if (a.size !== b.size) {
          return false;
        }
        let unmatchedEntries = a.size;
        for (const [aKey, aValue] of a.entries()) {
          for (const [bKey, bValue] of b.entries()) {
            /* Given that Map keys can be references, we need
             * to ensure that they are also deeply equal */ if (
              aKey === aValue && bKey === bValue && compare(aKey, bKey) ||
              compare(aKey, bKey) && compare(aValue, bValue)
            ) {
              unmatchedEntries--;
            }
          }
        }
        return unmatchedEntries === 0;
      }
      const merged = {
        ...a,
        ...b,
      };
      for (
        const key of [
          ...Object.getOwnPropertyNames(merged),
          ...Object.getOwnPropertySymbols(merged),
        ]
      ) {
        if (!compare(a && a[key], b && b[key])) {
          return false;
        }
        if (key in a && !(key in b) || key in b && !(key in a)) {
          return false;
        }
      }
      seen.set(a, b);
      return true;
    }
    return false;
  })(c, d);
}
/**
 * Deep equality comparison used in assertions
 * @param c actual value
 * @param d expected value
 */
Deep equality comparison used in assertions
@param c actual value
@param d expected value
Deep equality comparison used in assertions @param c actual value @param d expected value
function equal(c, d) {
  const seen = new Map();
  return (function compare(a, b) {
    if (
      a && b &&
      (a instanceof RegExp && b instanceof RegExp ||
        a instanceof URL && b instanceof URL)
    ) {
      return String(a) === String(b);
    }
    if (a instanceof Date && b instanceof Date) {
      const aTime = a.getTime();
      const bTime = b.getTime();
      if (Number.isNaN(aTime) && Number.isNaN(bTime)) {
        return true;
      }
      return a.getTime() === b.getTime();
    }
    if (Object.is(a, b)) {
      return true;
    }
    if (a && typeof a === "object" && b && typeof b === "object") {
      if (seen.get(a) === b) {
        return true;
      }
      if (Object.keys(a || {}).length !== Object.keys(b || {}).length) {
        return false;
      }
      if (isKeyedCollection(a) && isKeyedCollection(b)) {
        if (a.size !== b.size) {
          return false;
        }
        let unmatchedEntries = a.size;
        for (const [aKey, aValue] of a.entries()) {
          for (const [bKey, bValue] of b.entries()) {
             if (
              aKey === aValue && bKey === bValue && compare(aKey, bKey) ||
              compare(aKey, bKey) && compare(aValue, bValue)
            ) {
              unmatchedEntries--;
            }
          }
        }
        return unmatchedEntries === 0;
      }
      const merged = {
        ...a,
        ...b,
      };
      for (
        const key of [
          ...Object.getOwnPropertyNames(merged),
          ...Object.getOwnPropertySymbols(merged),
        ]
      ) {
        if (!compare(a && a[key], b && b[key])) {
          return false;
        }
        if (key in a && !(key in b) || key in b && !(key in a)) {
          return false;
        }
      }
      seen.set(a, b);
      return true;
    }
    return false;
  })(c, d);
}
function equal ( c , d ) { const seen = new Map ( ) ; return ( function compare ( a , b ) { if ( a && b && ( a instanceof RegExp && b instanceof RegExp || a instanceof URL && b instanceof URL ) ) { return String ( a ) === String ( b ) ; } if ( a instanceof Date && b instanceof Date ) { const aTime = a . getTime ( ) ; const bTime = b . getTime ( ) ; if ( Number . isNaN ( aTime ) && Number . isNaN ( bTime ) ) { return true ; } return a . getTime ( ) === b . getTime ( ) ; } if ( Object . is ( a , b ) ) { return true ; } if ( a && typeof a === "object" && b && typeof b === "object" ) { if ( seen . get ( a ) === b ) { return true ; } if ( Object . keys ( a || { } ) . length !== Object . keys ( b || { } ) . length ) { return false ; } if ( isKeyedCollection ( a ) && isKeyedCollection ( b ) ) { if ( a . size !== b . size ) { return false ; } let unmatchedEntries = a . size ; for ( const [ aKey , aValue ] of a . entries ( ) ) { for ( const [ bKey , bValue ] of b . entries ( ) ) { if ( aKey === aValue && bKey === bValue && compare ( aKey , bKey ) || compare ( aKey , bKey ) && compare ( aValue , bValue ) ) { unmatchedEntries -- ; } } } return unmatchedEntries === 0 ; } const merged = { ... a , ... b , } ; for ( const key of [ ... Object . getOwnPropertyNames ( merged ) , ... Object . getOwnPropertySymbols ( merged ) , ] ) { if ( ! compare ( a && a [ key ] , b && b [ key ] ) ) { return false ; } if ( key in a && ! ( key in b ) || key in b && ! ( key in a ) ) { return false ; } } seen . set ( a , b ) ; return true ; } return false ; } ) ( c , d ) ; }
Deep equality comparison used in assertions
 @param c actual value
 @param d expected value
Deep equality comparison used in assertions @param c actual value @param d expected value
// Have to render RegExp & Date for string comparison // unless it's mistreated as object // Check for NaN equality manually since NaN is not // equal to itself. /* Given that Map keys can be references, we need
             * to ensure that they are also deeply equal */