object allow only specific keys lodash code example
Example: lodash filter object keys
var user = {
"first_name":"taylor",
"last_name":"hawkes",
"full_name": "taylor hawkes"
};
var userCleaned = _.pickBy(user, function(value, key) {
return (key === "first_name" || key === "last_name");
});
//userCleaned is now:
//{
// "first_name": "taylor",
// "last_name": "hawkes"
//}