( key: string )
| 555 | |
| 556 | /** Parse a folder favorite key back into its `{ folder, subpath }` parts. */ |
| 557 | export function parseFavoriteFolderKey( |
| 558 | key: string |
| 559 | ): { folder: NoteFolder; subpath: string } | null { |
| 560 | const idx = key.indexOf(':') |
| 561 | if (idx === -1) return null |
| 562 | const folder = key.slice(0, idx) as NoteFolder |
| 563 | return { folder, subpath: key.slice(idx + 1) } |
| 564 | } |
| 565 | |
| 566 | /** Toggle a favorite key, returning the next list (added at the end, or removed). */ |
| 567 | export function toggleFavorite(favorites: string[], key: string): string[] { |
no outgoing calls
no test coverage detected