How can I exclude certain properties in a JSON object that contain specific characters?
var obj1 = {name: "James", age: 17, creation: "13-02-2016", deletion: "13-04-2016", foo_x:"", foo_y:"", foo_z:""}
var obj2 = {name: "Maria", age: 17, creation: "13-02-2016", deletion: "13-04-2016", foo_x:"", foo_y:"", foo_z:""}
Now, I want to remove all properties that contain the string foo
.
var result = _.isEqual(
_.omit(obj1, ['\*foo\*']),
_.omit(obj2, ['\*foo\*'])
);
Is there a way to achieve this? Any suggestions would be appreciated.