question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Map object returns true regardless of key entries

See original GitHub issue

Copied from node console:

> const equal = require('fast-deep-equal');
undefined
> const mapA = new Map();
undefined
> const mapB = new Map();
undefined
> equal(mapA, mapB)
true
> mapA.set('a', 1);
Map { 'a' => 1 }
> equal(mapA, mapB)
true

My guess is because they both have the same key properties

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
toburgercommented, Sep 6, 2018

The same is true for Sets:

> equal(new Set([1]), new Set([2]))
true
0reactions
epoberezkincommented, Jul 7, 2019

released in beta

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the reasons why Map.get(Object key) is not (fully) ...
When a map returns key values, it conserves as much type information as it can, by using the type parameter. Share.
Read more >
Map and Set
map.has(key ) – returns true if the key exists, false otherwise. map.delete(key) – removes the element (the key/value pair) by the key. map.clear ......
Read more >
When to Use Map instead of Plain JavaScript Object
Map's main benefits over plain object is allowing keys of any type and any name. ... booleansMap uses booleans true and false as...
Read more >
Map - JavaScript - MDN Web Docs - Mozilla
The keys in Map are ordered in a simple, straightforward way: A Map object iterates entries, keys, and values in the order of...
Read more >
Java Map
This Map can now only accept String objects for keys, and MyObject instances for values. You can then access and iterate keys and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found