2026-04-21 Post about adding notes hierarchy
This commit is contained in:
@@ -3,14 +3,14 @@ export interface HierarchyNode {
|
||||
title: string | null;
|
||||
children: Hierarchy | null;
|
||||
}
|
||||
export interface Hierarchy extends Record<string, HierarchyNode> {}
|
||||
type Hierarchy = Record<string, HierarchyNode>;
|
||||
|
||||
function addToHierarchy(
|
||||
tree: Hierarchy,
|
||||
[noteId, title]: [string, string],
|
||||
): Hierarchy {
|
||||
const path = noteId.split("/");
|
||||
if (path.length === 0) {
|
||||
if (path.length === 0 || path[0] === "") {
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user