📌  相关文章
📜  lodash 计算数组中的重复项 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:14.953000             🧑  作者: Mango

代码示例1
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);