Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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"
//}
 
PREVIOUS NEXT
Tagged: #lodash #filter #object #keys
ADD COMMENT
Topic
Name
1+4 =