Answers for "lodash find duplicate element index"

0

lodash find duplicate element index

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);
Posted by: Guest on May-06-2020

Code answers related to "lodash find duplicate element index"

Code answers related to "Javascript"

Browse Popular Code Answers by Language