MCPcopy Create free account
hub / github.com/bytebase/bytebase / isSubFolder

Function isSubFolder

frontend/src/views/sql-editor/Sheet/folder.ts:12–29  ·  view source on GitHub ↗
({
  parent,
  path,
  dig,
}: {
  parent: string;
  path: string;
  dig: boolean;
})

Source from the content-addressed store, hash-verified

10 * `/{view}` root prefix) must be treated as inert — never as subfolders.
11 */
12export const isSubFolder = ({
13 parent,
14 path,
15 dig,
16}: {
17 parent: string;
18 path: string;
19 dig: boolean;
20}): boolean => {
21 const parentPrefix = `${parent}/`;
22 if (path === parentPrefix || !path.startsWith(parentPrefix)) {
23 return false;
24 }
25 if (dig) {
26 return true;
27 }
28 return !path.slice(parentPrefix.length).includes("/");
29};

Callers 4

listSubFoldersFunction · 0.90
removeFolderFunction · 0.90
moveFolderFunction · 0.90
folder.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected