📅  最后修改于: 2022-03-11 14:56:14.953000             🧑  作者: Mango
const data = ["apple", "banana", "apple", "orange", "grapes", "mango", "banana"];
const result = _.values(_.groupBy(data)).map(d => ({name: d[0], count: d.length}));
console.log(result);