function hasDuplicates(a) {
return _.uniq(a).length !== a.length;
}
var a = [1,2,1,3,4,5];
var b = [1,2,3,4,5,6];
document.write(hasDuplicates(a), ',',hasDuplicates(b));
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);