remove objects from an array lodash code example
Example 1: lodash remove element from list
var colors = ["red","blue","green","green"];
var greens = _.remove(colors, function(c) {
return (c === "green"); //remove if color is green
});
//colors is now ["red","blue"]
//greens is now ["green","green"]
Example 2: remove empty object from array lodash
var myArrayFiltered = myArray.filter((ele) => {
return ele.constructor === Object && Object.keys(ele).length > 0
});