update extension api

This commit is contained in:
vcoppe
2025-11-12 14:48:17 +01:00
parent 110f23bdf1
commit 0eca588280
2 changed files with 43 additions and 43 deletions

View File

@@ -66,12 +66,12 @@ export function remove(node: LayerTreeType, id: string) {
return node;
}
export function removeByPrefix(node: LayerTreeType, prefix: string) {
export function removeAll(node: LayerTreeType, ids: string[]) {
Object.keys(node).forEach((key) => {
if (key.startsWith(prefix)) {
if (ids.includes(key)) {
delete node[key];
} else if (typeof node[key] !== 'boolean') {
removeByPrefix(node[key], prefix);
removeAll(node[key], ids);
}
});
return node;