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

Function hasIntersect

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

Source from the content-addressed store, hash-verified

100 * @returns
101 */
102export function hasIntersect<T extends number | string>(array1: T[], array2: T[]) {
103 if (!Array.isArray(array1) || !Array.isArray(array2)) {
104 return false;
105 }
106 const set1 = new Set(array1);
107 const set2 = new Set(array2);
108
109 for (const ele of set1) {
110 if (set2.has(ele)) {
111 return true;
112 }
113 }
114 return false;
115}
116
117export function array2Map<T>(arr: T[], key: string) {
118 return arr.reduce((obj: {}, element: T) => {

Callers 2

isMeetFilterFunction · 0.90
isMeetFilterMethod · 0.90

Calls 1

hasMethod · 0.65

Tested by

no test coverage detected