Skip to content

Instantly share code, notes, and snippets.

@mcmath
mcmath / deepEqual.js
Created January 12, 2022 21:15
deepEqual.js
/**
* Tests whether two values are deeply equal using same-value equality.
*
* Two values are considered deeply equal iff 1) they are the same value,
* 2) they are both arrays whose length and elements are deeply equal, or 3) they are both
* non-callable, non-array objects whose own, enumerable, string-keyed
* properties are deeply equal.
*
* Caution: This function does not fully support circular references. Use this
* function only if you are sure that at least one of the arguments has no