1var person = {"name":"bill","age":21,"sex":undefined,"height":"crap"};
2//remove undefined properties or other crap
3var cleanPerson = _.pickBy(person, function(value, key) {
4 return !(value === undefined || value === "crap");
5});
6//cleanPerson is now { "name": "bill","age": 21}
1var myArrayFiltered = myArray.filter((ele) => {
2 return ele.constructor === Object && Object.keys(ele).length > 0
3});