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

Function isSubSet

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

Source from the content-addressed store, hash-verified

74 * @returns
75 */
76export function isSubSet<T extends number | string>(array1: T[], array2: T[]) {
77 if (!Array.isArray(array1) || !Array.isArray(array2)) {
78 return false;
79 }
80 const set1 = new Set(array1);
81 const set2 = new Set(array2);
82 if (set1.size > set2.size) {
83 return false;
84 }
85 for (const ele of set1) {
86 if (!set2.has(ele)) {
87 return false;
88 }
89 }
90 return true;
91}
92
93/**
94 * Is the intersection empty

Callers

nothing calls this directly

Calls 1

hasMethod · 0.65

Tested by

no test coverage detected