我如何在lodash
中编写以下嵌套循环?什么是最简洁的,并希望更具语义性的语法?
for (var i = 0, m = 0, inner, item, needle = 'someval'; i < items.length; i++) {
item = items[i];
for (m = 0; m < item.inners.length; m++) {
inner = item.inners[m];
if (inner.id === needle)
return { items : item.id };
}
}