I am trying to create a feature where I want users to be able to enter in conditions to show certain elements.
Although I'm flexible on the input method, the best way I can think of is to eval()
the provided condition string.
My first instinct is to do this:
var usercondition = "3<5"
var showelement = eval(userconditon)
or
var usercondition = "aVarWithANumber < 5"
var showelement = Function(`return (${usercondition})`)()
but I understand that there are security risks to using these methods. (I am planning on running this server side)
Are there better ways to evaluate a string as true or false?