Skip to content

Commit

Permalink
Use Set instead of WeakMap
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Dec 6, 2020
1 parent 9f14112 commit 2f6ddd6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.jst
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ module.exports = function equal(a, b, compared) {
if (a.constructor !== b.constructor) return false;

{{? it.es6 && it.cycles }}
if (!compared) compared = { a: new WeakMap(), b: new WeakMap() };
if (!compared) compared = { a: new Set(), b: new Set() };
if (compared.a.has(a) && compared.b.has(b)) return true;
if (!compared.a.has(a)) compared.a.set(a, true);
if (!compared.b.has(b)) compared.b.set(b, true);
if (!compared.a.has(a)) compared.a.add(a);
if (!compared.b.has(b)) compared.b.add(b);
{{?}}

var length, i, keys;
Expand Down

0 comments on commit 2f6ddd6

Please sign in to comment.