I have a list of String with duplicate entries , So i want to remove them irrespective of Case
let duplicates = ['Hello', 'Hi', 'hello'];
let uniques = _.methodName(duplicates);
// output should be
['hello','Hi'] OR ['Hello','Hi']
You can use _.uniqWith() with a callback as following:
let duplicates = ['Hello', 'Hi', 'hello'];
let uniques = _.uniqWith(duplicates, (a,b) => a.toLowerCase() === b.toLowerCase())
console.log(uniques);
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With