dist/index.js
// Internal recursive comparison function for `isEqual`.
Internal recursive comparison function for `isEqual`.
Internal recursive comparison function for ` isEqual ` .
function deepEq(a, b, aStack, bStack) {
    if (a instanceof _) a = a._wrapped;
    if (b instanceof _) b = b._wrapped;
    var className = toString.call(a);
    if (className !== toString.call(b)) return false;
    switch (className) {
      case '[object RegExp]':
      case '[object String]':
        return '' + a === '' + b;
      case '[object Number]':
        if (+a !== +a) return +b !== +b;
        return +a === 0 ? 1 / +a === 1 / b : +a === +b;
      case '[object Date]':
      case '[object Boolean]':
        return +a === +b;
      case '[object Symbol]':
        return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b);
    }
    var areArrays = className === '[object Array]';
    if (!areArrays) {
      if (typeof a != 'object' || typeof b != 'object') return false;
      var aCtor = a.constructor, bCtor = b.constructor;
      if (aCtor !== bCtor && !(isFunction(aCtor) && aCtor instanceof aCtor &&
                               isFunction(bCtor) && bCtor instanceof bCtor)
                          && ('constructor' in a && 'constructor' in b)) {
        return false;
      }
    }
    aStack = aStack || [];
    bStack = bStack || [];
    var length = aStack.length;
    while (length--) {
      if (aStack[length] === a) return bStack[length] === b;
    }
    aStack.push(a);
    bStack.push(b);
    if (areArrays) {
      length = a.length;
      if (length !== b.length) return false;
      while (length--) {
        if (!eq(a[length], b[length], aStack, bStack)) return false;
      }
    } else {
      var _keys = keys(a), key;
      length = _keys.length;
      if (keys(b).length !== length) return false;
      while (length--) {
        key = _keys[length];
        if (!(_has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
      }
    }
    aStack.pop();
    bStack.pop();
    return true;
  }
function deepEq ( a , b , aStack , bStack ) { if ( a instanceof _ ) a = a . _wrapped ; if ( b instanceof _ ) b = b . _wrapped ; var className = toString . call ( a ) ; if ( className !== toString . call ( b ) ) return false ; switch ( className ) { case '[object RegExp]' : case '[object String]' : return '' + a === '' + b ; case '[object Number]' : if ( + a !== + a ) return + b !== + b ; return + a === 0 ? 1 / + a === 1 / b : + a === + b ; case '[object Date]' : case '[object Boolean]' : return + a === + b ; case '[object Symbol]' : return SymbolProto . valueOf . call ( a ) === SymbolProto . valueOf . call ( b ) ; } var areArrays = className === '[object Array]' ; if ( ! areArrays ) { if ( typeof a != 'object' || typeof b != 'object' ) return false ; var aCtor = a . constructor , bCtor = b . constructor ; if ( aCtor !== bCtor && ! ( isFunction ( aCtor ) && aCtor instanceof aCtor && isFunction ( bCtor ) && bCtor instanceof bCtor ) && ( 'constructor' in a && 'constructor' in b ) ) { return false ; } } aStack = aStack || [ ] ; bStack = bStack || [ ] ; var length = aStack . length ; while ( length -- ) { if ( aStack [ length ] === a ) return bStack [ length ] === b ; } aStack . push ( a ) ; bStack . push ( b ) ; if ( areArrays ) { length = a . length ; if ( length !== b . length ) return false ; while ( length -- ) { if ( ! eq ( a [ length ] , b [ length ] , aStack , bStack ) ) return false ; } } else { var _keys = keys ( a ) , key ; length = _keys . length ; if ( keys ( b ) . length !== length ) return false ; while ( length -- ) { key = _keys [ length ] ; if ( ! ( _has ( b , key ) && eq ( a [ key ] , b [ key ] , aStack , bStack ) ) ) return false ; } } aStack . pop ( ) ; bStack . pop ( ) ; return true ; }
Internal recursive comparison function for `isEqual`.
Internal recursive comparison function for ` isEqual ` .
// Unwrap any wrapped objects. // Compare `[[Class]]` names. // Strings, numbers, regular expressions, dates, and booleans are compared by value. // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. // `NaN`s are equivalent, but non-reflexive. // Object(NaN) is equivalent to NaN. // An `egal` comparison is performed for other numeric values. // Coerce dates and booleans to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are not equivalent. // Objects with different constructors are not equivalent, but `Object`s or `Array`s // from different frames are. // Assume equality for cyclic structures. The algorithm for detecting cyclic // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. // Initializing stack of traversed objects. // It's done here since we only need them for objects and arrays comparison. // Linear search. Performance is inversely proportional to the number of // unique nested structures. // Add the first object to the stack of traversed objects. // Recursively compare objects and arrays. // Compare array lengths to determine if a deep comparison is necessary. // Deep compare the contents, ignoring non-numeric properties. // Deep compare objects. // Ensure that both objects contain the same number of properties before comparing deep equality. // Deep compare each member // Remove the first object from the stack of traversed objects.