Skip to content

WellKnownEqualityComparisonStrategy

WellKnownEqualityComparisonStrategy = "loose" | "strict" | "sameValue" | "sameValueZero"

Defined in: packages/core/src/object/is-equal.ts:23

A type representing well-known equality comparison strategies for item comparison.

It can be one of the following string literals:

  • "loose": Uses loose equality (==) for comparison. Double equals (==) will perform a type conversion when comparing two things, and will handle NaN, -0, and +0 specially to conform to IEEE 754 (so NaN != NaN, and -0 == +0)
  • "strict": Uses strict equality (===) for comparison. Triple equals (===) will do the same comparison as double equals (including the special handling for NaN, -0, and +0) but without type conversion; if the types differ, false is returned.
  • "sameValue": Uses Object.is() for comparison. Object.is() does no type conversion and no special handling for NaN, -0, and +0 (giving it the same behavior as === except on those special numeric values).
  • "sameValueZero": Uses Object.is() but +0 and -0 are considered equal.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Equality_comparisons_and_sameness