A library's size counts what is under its top-level nodes, the same in /api/libraries and the root's byline (a root alone is 0 nodes)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
1 parent
a6dbfbc19f
commit
f888525808
5 files changed
+13
-8
No files matched your search
@@ -897,6 +897,9 @@ export function tops(snap: Snap): NodeId[] {
|
||||
|
||||
export const isLibraryRoot = (snap: Snap, id: NodeId) => snap.library && id === snap.root;
|
||||
|
||||
/** How many nodes a library holds: everything under its top-level nodes, the root and the Wikipedia container left out (0 for a root alone). */
|
||||
export const libraryNodeCount = (snap: Snap) => tops(snap).reduce((n, d) => n + 1 + descendants(snap, d).length, 0);
|
||||
|
||||
/**
|
||||
* The top of a node's branch: its ancestor (or itself) among the root's children. A relation, not
|
||||
* a kind of node. None for the library root itself; in a single tree, the root.
|
||||
|
||||
Reference in new issue
Block a user