creating a boolean evaluator in javascript

i have some text like

text = "this is some text that have a bunch of words in it."

I have a boolean expression that will run against that text, for example:

boolPhrase = "(text OR keyword) AND (words OR keyword2)"

in this scenario, it would evaluate to be (true OR false) AND (true OR false) –> which evaluates to be true

so if I had the function that handles this logic

result = booleanEvaluator(text, boolPhrase)

I was able to do this using .eval() but I didn’t realize chrome blocks eval most of the time.

is there a javascript library that handles this kind of thing? or do I need to write this from scratch?