-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Closed
Copy link
Labels
help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.
Description
-
Version:
v9.4.0 -
Platform:
OSX, Linux, Windows -
Subsystem:
N/A
util.isDeepStrictEqual always returns true when WeakMap/WeakSet comparison.
const util = require('util');
const wm1 = new WeakMap();
const wm2 = new WeakMap();
const key = {};
wm1.set(key, 1);
wm2.set(key, 2);
console.log(util.isDeepStrictEqual(wm1, wm2)); // true
this is because WeakMap|WeakSet.prototype.valueOf always returns empty object.
I know WeakMap / WeakSet do not have an API to show the full content, and they depends on GC so those collection comparison is very difficult.
However, this behavior (always return true) seems to be curious for me. I think it would be better to always return false.
mcollina and okikio
Metadata
Metadata
Assignees
Labels
help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.