* A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to com
(object, other, tag, bitmask, customizer, equalFunc, stack)
| 52692 | * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. |
| 52693 | */ |
| 52694 | function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { |
| 52695 | switch (tag) { |
| 52696 | case dataViewTag: |
| 52697 | if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { |
| 52698 | return false; |
| 52699 | } |
| 52700 | object = object.buffer; |
| 52701 | other = other.buffer; |
| 52702 | |
| 52703 | case arrayBufferTag: |
| 52704 | if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { |
| 52705 | return false; |
| 52706 | } |
| 52707 | return true; |
| 52708 | |
| 52709 | case boolTag: |
| 52710 | case dateTag: |
| 52711 | case numberTag: |
| 52712 | // Coerce booleans to `1` or `0` and dates to milliseconds. |
| 52713 | // Invalid dates are coerced to `NaN`. |
| 52714 | return eq(+object, +other); |
| 52715 | |
| 52716 | case errorTag: |
| 52717 | return object.name == other.name && object.message == other.message; |
| 52718 | |
| 52719 | case regexpTag: |
| 52720 | case stringTag: |
| 52721 | // Coerce regexes to strings and treat strings, primitives and objects, |
| 52722 | // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring |
| 52723 | // for more details. |
| 52724 | return object == other + ''; |
| 52725 | |
| 52726 | case mapTag: |
| 52727 | var convert = mapToArray; |
| 52728 | |
| 52729 | case setTag: |
| 52730 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG; |
| 52731 | convert || (convert = setToArray); |
| 52732 | |
| 52733 | if (object.size != other.size && !isPartial) { |
| 52734 | return false; |
| 52735 | } |
| 52736 | // Assume cyclic values are equal. |
| 52737 | var stacked = stack.get(object); |
| 52738 | if (stacked) { |
| 52739 | return stacked == other; |
| 52740 | } |
| 52741 | bitmask |= COMPARE_UNORDERED_FLAG; |
| 52742 | |
| 52743 | // Recursively compare objects (susceptible to call stack limits). |
| 52744 | stack.set(object, other); |
| 52745 | var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); |
| 52746 | stack['delete'](object); |
| 52747 | return result; |
| 52748 | |
| 52749 | case symbolTag: |
| 52750 | if (symbolValueOf) { |
| 52751 | return symbolValueOf.call(object) == symbolValueOf.call(other); |
no test coverage detected