lodash find duplicates in array code example
Example 1: how to collect keys using lodash javascript
import * as _ from 'lodash';
const objectMap = {'key1': 'value1', 'key2': 'value2'};
const allKeys = _.keys(objectMap);
Example 2: 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);
Example 3: lodash map
const _quote_filter = _.map(quote_state, (val, key) => { if (val) { return key }})console.log(_quote_filter)