remove unused intersect

This commit is contained in:
MathMan05
2025-11-25 23:28:56 -06:00
parent 10147dda08
commit b3de3ddd9c
2 changed files with 0 additions and 15 deletions

View File

@@ -64,14 +64,4 @@ describe("Array extensions", () => {
[],
);
});
it("intersect", () => {
const arr1 = [1, 2, 3, 4];
const arr2 = [3, 4, 5, 6];
assert.deepEqual(arr1.intersect(arr2), [3, 4]);
assert.deepEqual(arr1.intersect([]), []);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
assert.deepEqual([].intersect(arr2), []);
});
});

View File

@@ -25,7 +25,6 @@ declare global {
remove(item: T): void;
distinct(): T[];
distinctBy<K>(key: (elem: T) => K): T[];
intersect(other: T[]): T[];
}
}
@@ -117,7 +116,3 @@ if (!Array.prototype.distinctBy)
Array.prototype.distinctBy = function <T, K>(this: T[], key: (elem: T) => K) {
return arrayDistinctBy.call(this, key as (elem: unknown) => unknown);
};
if (!Array.prototype.intersect)
Array.prototype.intersect = function <T>(this: T[], other: T[]) {
return arrayIntersect.call(this, other);
};