Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

_base-is-equal

v4.17.11arrow_drop_down
v4.17.11
STATUS
Passing
DOWNLOADS
844
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
A year ago
SIZE
6 KB
1 contributor
Install _base-is-equal as a package?
Copied
npm i @bit/lodash.lodash.internal._base-is-equal
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
_baseIsEqual.js
28 Lines(12 sloc)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import baseIsEqualDeep from './_baseIsEqualDeep.js';
import isObjectLike from './isObjectLike.js';

/**
 * 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 {boolean} bitmask The bitmask flags.
 *  1 - Unordered comparison
 *  2 - Partial comparison
 * @param {Function} [customizer] The function to customize comparisons.
 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
 * @returns {boolean} 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 || (!isObjectLike(value) && !isObjectLike(other))) {
    return value !== value && other !== other;
  }
  return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}

export default baseIsEqual;