1// Block list
2// Remove the values you don't want
3var result = _.omit(credentials, ['age']);
4
5// Allow list
6// Only allow certain values
7var result = _.pick(credentials, ['fname', 'lname']);
8
1var colors = ["red",undefined,"","blue",null,"crap"];
2// remove undefined, null, "" and any other crap
3var cleanColors=_.without(colors,undefined,null,"","crap");
4//cleanColors is now ["red","blue"];
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}