Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Takes a collection of data and removes any duplicates, based on key, thare are not null. If the key value is null, it is not filtered out.
var deDupeNonNull = function(data, key){
var used = [];
return _.reduce(data, function(cur, data){
if(!!data[key] && !_.includes(used, data[key])){
else if(!data[key]) {
return cur;
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.