MCPcopy Index your code
hub / github.com/apitable/apitable / isSameSet

Function isSameSet

packages/core/src/utils/array.ts:50–65  ·  view source on GitHub ↗
(array1: T[], array2: T[])

Source from the content-addressed store, hash-verified

48 * @returns
49 */
50export function isSameSet<T extends number | string>(array1: T[], array2: T[]) {
51 if (!Array.isArray(array1) || !Array.isArray(array2)) {
52 return false;
53 }
54 const set1 = new Set(array1);
55 const set2 = new Set(array2);
56 if (set1.size !== set2.size) {
57 return false;
58 }
59 for (const ele of set1) {
60 if (!set2.has(ele)) {
61 return false;
62 }
63 }
64 return true;
65}
66
67/**
68 * Check if array1 is a subset of array2

Callers 3

isMeetFilterFunction · 0.90
isMeetFilterMethod · 0.90
collectByChangeFieldMethod · 0.90

Calls 1

hasMethod · 0.65

Tested by

no test coverage detected