MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / formDirContaining

Function formDirContaining

packages/shared-domain/src/databases.ts:87–95  ·  view source on GitHub ↗
(relPath: string)

Source from the content-addressed store, hash-verified

85 * otherwise null. e.g. `a/X.base/pages/r.md` → `a/X.base`.
86 */
87export function formDirContaining(relPath: string): string | null {
88 const parts = toPosixPath(relPath).split('/')
89 for (let i = 0; i < parts.length; i++) {
90 if (parts[i].toLowerCase().endsWith(FORM_DIR_SUFFIX)) {
91 return parts.slice(0, i + 1).join('/')
92 }
93 }
94 return null
95}
96
97/** Display title from a database folder name/path (strips the `.base` suffix). */
98export function formTitleFromDir(nameOrPath: string): string {

Callers 4

databases.test.tsFile · 0.90
isDatabaseInternalPathFunction · 0.85
isDatabaseCsvPathFunction · 0.85
databaseCsvPathForFunction · 0.85

Calls 1

toPosixPathFunction · 0.85

Tested by

no test coverage detected