MCPcopy Create free account
hub / github.com/experdot/pointer / isInFolders

Function isInFolders

src/renderer/src/utils/globalSearchUtils.ts:44–64  ·  view source on GitHub ↗

* 检查页面是否在指定的文件夹中(包括子文件夹)

(
  pageParentFolderId: string | undefined,
  folderIds: string[] | undefined,
  folders: PageFolder[]
)

Source from the content-addressed store, hash-verified

42 * 检查页面是否在指定的文件夹中(包括子文件夹)
43 */
44function isInFolders(
45 pageParentFolderId: string | undefined,
46 folderIds: string[] | undefined,
47 folders: PageFolder[]
48): boolean {
49 // 没有文件夹筛选,所有页面都符合
50 if (!folderIds || folderIds.length === 0) return true
51
52 // 页面没有父文件夹,不在任何文件夹中
53 if (!pageParentFolderId) return false
54
55 // 检查页面是否在指定文件夹或其子文件夹中
56 let currentFolderId: string | undefined = pageParentFolderId
57 while (currentFolderId) {
58 if (folderIds.includes(currentFolderId)) return true
59 const folder = folders.find((f) => f.id === currentFolderId)
60 currentFolderId = folder?.parentFolderId
61 }
62
63 return false
64}
65
66/** 每个页面最多显示的匹配数 */
67const MAX_MATCHES_PER_PAGE = 50

Callers 1

performGlobalSearchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected