I have a javascript object, that could be something like this
{
"users": [{
"id": "52",
"name": "User name one",
"profile": "student",
"statusId": 1
},...
I want to modify this object's properties given a set of parameters. Basically I want a new object which properties could match a set of constraints - a filter object - with this form (empty filter):
var userFilter = {
id : "",
name: "",
profile : "",
state : ""
};
I've seen the Array.prototype.filter, but can't figure a clean and generic way to use all properties of filter. I've tried this approach with a javascript string that concats all filters and using eval(), but I don't like this approach. Any suggestion ?
Thanks in advance, regards