@newdash/newdash
Version:
javascript/typescript utility library
32 lines (31 loc) • 1.29 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const baseIsEqualDeep_1 = __importDefault(require("./baseIsEqualDeep"));
const isObjectLike_1 = __importDefault(require("../isObjectLike"));
/**
* The base implementation of `isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param value The value to compare.
* @param other The other value to compare.
* @param bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param [customizer] The function to customize comparisons.
* @param [stack] Tracks traversed `value` and `other` objects.
* @returns Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!(0, isObjectLike_1.default)(value) && !(0, isObjectLike_1.default)(other))) {
return value !== value && other !== other;
}
return (0, baseIsEqualDeep_1.default)(value, other, bitmask, customizer, baseIsEqual, stack);
}
exports.default = baseIsEqual;