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);
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);