Skip to content

Commit 45ae52f

Browse files
authored
doc: mention constructor comparison in assert.deepStrictEqual
Updated `assert.deepStrictEqual` docs to explicitly mention that object constructors are included in the comparison. This clarifies behavior consistent with `util.isDeepStrictEqual` and helps prevent confusion when comparing derived objects or proxy instances.
1 parent 0c35aaf commit 45ae52f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

doc/api/assert.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ are also recursively evaluated by the following rules.
399399
both sides are {NaN}.
400400
* [Type tags][Object.prototype.toString()] of objects should be the same.
401401
* Only [enumerable "own" properties][] are considered.
402+
* Object constructors are also compared to ensure that instances are strictly deep-equal.
403+
This means that even if two objects share the same prototype and properties, differing constructors will result in inequality.
402404
* {Error} names, messages, causes, and errors are always compared,
403405
even if these are not enumerable properties.
404406
* [Object wrappers][] are compared both as objects and unwrapped values.

0 commit comments

Comments
 (0)