linq js groupBy 使用示例
var list=[
{id:1,name:"lily",gender:0,o:{id:123}},
{id:2,name:"lucy",gender:0,o:{id:456}},
{id:3,name:"lilei",gender:1,o:{id:123}},
{id:4,name:"hanmeimei",gender:0,o:{id:789}}
];
Enumerable.from(list).groupBy(x=>x.o.id).select(x=>({key:x.key(),source:x.getSource()})).toArray();
参考文章
https://github.com/mihaifm/linq/blob/master/sample/tutorial.js