findItem(id, items = null) {
if (!items) {
items = this.items;
}
return items.reduce((acc, item) => {
if (acc) {
return acc;
}
if (item.id === id) {
return item;
}
if (item.children) {
return this.findItem(id, item.children);
}
return acc;
}, null);
}