mirror of https://github.com/laurent22/joplin.git
22 lines
524 B
TypeScript
22 lines
524 B
TypeScript
import { FolderEntity } from '../../services/database/types';
|
|
import Folder, { FolderEntityWithChildren } from '../Folder';
|
|
|
|
export default (folders: FolderEntity[]) => {
|
|
const tree = Folder.buildTree(folders);
|
|
|
|
const canBeCollapsedIds: string[] = [];
|
|
|
|
const processTree = (folders: FolderEntityWithChildren[]) => {
|
|
for (const folder of folders) {
|
|
if (folder.children.length) {
|
|
canBeCollapsedIds.push(folder.id);
|
|
processTree(folder.children);
|
|
}
|
|
}
|
|
};
|
|
|
|
processTree(tree);
|
|
|
|
return canBeCollapsedIds;
|
|
};
|