I'm trying to process an array of JSON objects that have various common attributes, filtering each array entry on one or more of those attributes.

Normally, I'd just do it something like this:

```
let filteredResultsArray = originalArray.filter((obj) => {
   return obj.attribute1 <= 3 && obj.attribute2 > 0 && obj.attribute3 === 10;
});

```

My problem is that the filter parameters (the part after "return" in the code above) are highly variable (and unpredictable) from run to run, so I can't hard-code them in the filter. I compute them on the fly and store the whole thing in a string in my code. For example, on one run it might be:

```
myAttributeString = "obj.attribute1 <= 3 && obj.attribute2 > 0 && obj.attribute3 === 10";

```

I've tried doing this:

```
let filteredResultsArray = originalArray.filter((obj) => {
       return myAttributeString;
    });

```

That's failing to filter anything. Apparently `.filter()` is not properly interpreting what I've stored in `myAttributeString` as filter criteria.

I have a sneaking suspicion that `eval(myAttributeString)` might be one way to pull this off, but unfortunately I'm working on a team where we've got tslint set to disallow the use of `eval()`, so that's not an option.

Anybody have an idea how I can get this to work?