``` _(x) .map(x => _.values(x.so)) .fla...
# suitescript
s
Copy code
_(x)
    .map(x => _.values(x.so))
    .flatMap(_.values)
    .map(x => x.lines)
    .flatMap(_.values)
    .groupBy('itemId')
    .value();
is a bit shorter by using flatmaps instead of map and flatten