📅  最后修改于: 2022-03-11 15:01:38.655000             🧑  作者: Mango
const _ = require('lodash');
let arr = ["a", "a", "b", "c", "c", "a"];
let result = _.omitBy(
_.reduce(arr, (a, v, i) => _.set(a, v, (a[v] || []).concat([i])), {} ),
v => v.length <= 1
);
console.log(result);