From 11a23eae056b24592622b968c0ca65ccb66d7231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Mon, 9 Nov 2026 20:20:05 +0100 Subject: [PATCH 1/2] fix disjoint for dates --- src/disjoint.js | 2 +- test/disjoint-test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/disjoint.js b/src/disjoint.js index d62a6701..ddb914ae 100644 --- a/src/disjoint.js +++ b/src/disjoint.js @@ -7,8 +7,8 @@ export default function disjoint(values, other) { let value, done; while (({value, done} = iterator.next())) { if (done) break; - if (Object.is(v, value)) return false; set.add(value); + if (set.has(v)) return false; } } return true; diff --git a/test/disjoint-test.js b/test/disjoint-test.js index 30e691a7..bb94add9 100644 --- a/test/disjoint-test.js +++ b/test/disjoint-test.js @@ -20,6 +20,7 @@ it("disjoint(values, other) performs interning", () => { assert.strictEqual(disjoint([new Date("2021-01-01")], [new Date("2021-01-02")]), true); assert.strictEqual(disjoint([new Date("2021-01-02"), new Date("2021-01-03")], [new Date("2021-01-03"), new Date("2021-01-04")]), false); assert.strictEqual(disjoint([new Date("2021-01-01")], []), true); + assert.strictEqual(disjoint([new Date("2021-01-01")], [new Date("2021-01-01")]), false); }); function* odds() { From b051bdc1ef93dce72d962e481e553311f1b62460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Mon, 9 Nov 2026 20:20:16 +0100 Subject: [PATCH 2/2] fix superset for -0 and 0 --- src/superset.js | 2 +- test/superset-test.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/superset.js b/src/superset.js index d178e9c2..2d315501 100644 --- a/src/superset.js +++ b/src/superset.js @@ -8,7 +8,7 @@ export default function superset(values, other) { if (done) return false; const ivalue = intern(value); set.add(ivalue); - if (Object.is(io, ivalue)) break; + if (set.has(io)) break; } } return true; diff --git a/test/superset-test.js b/test/superset-test.js index 3b6221b5..44777d38 100644 --- a/test/superset-test.js +++ b/test/superset-test.js @@ -22,6 +22,11 @@ it("superset(values, other) performs interning", () => { assert.strictEqual(superset([new Date("2021-01-01")], []), true); }); +it("superset(values, other) treats -0 and 0 as equal", () => { + assert.strictEqual(superset([-0], [0]), true); + assert.strictEqual(superset([0], [-0]), true); +}); + function* odds() { for (let i = 1; true; i += 2) { yield i;