So I\'m using Vue to filter a list. This consists of the following structure (Baum Hierarchy if anyone is interested):
[
{
\"id\": 61,
\"created_at\":
you can do it with recursive function
var res = _.reduce(this.sortable, function reducer(result, item) {
if (item.name.search(new RegExp(search, "i")) !== -1) {
result.items = _.concat(result.items, result.parent || item);
}
result.items = _.concat(
result.items,
_.reduce(item.children, reducer, {parent: item, items: []}).items
)
return result;
}, {items: []}).items;